Re: Oracle SQL UPDATE from SUBSELECT results ?

From: Brian E Dick <bdick_at_cox.net>
Date: Tue, 16 Apr 2002 12:44:47 GMT
Message-ID: <31Vu8.35942$GG1.2473037_at_news2.east.cox.net>


Something like

UPDATE news_headlines_new n
SET found_date= (select o.found_date

                             from news_headlines o
                             where o.text = n.text
                             and o.url = n.url)
WHERE exists (SELECT *
                         FROM news_headlines o
                         WHERE n.text = o.text
                          AND n.url = o.url);

"Sam Iam" <thatsamiam_at_yahoo.com> wrote in message news:fe7db0d0.0204151743.6e6abe02_at_posting.google.com...
> I am an Oracle newbie.
>
> I want to update a column with data that comes as the result of a
 subselect.
>
> This syntax doesn't work but it does illustrate what I want to do.
>
> What's the way to do this in Oracle ?
>
> - Sam.
>
> UPDATE news_headlines_new SET found_date=o.found_date
> WHERE headline_id=n.headline_id (
> SELECT n.headline_id, o.found_date
> FROM news_headlines_new n, news_headlines o
> WHERE n.text = o.text AND n.url = o.url
> );
Received on Tue Apr 16 2002 - 14:44:47 CEST

Original text of this message