Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Help me double check this query. Please?

Re: Help me double check this query. Please?

From: Sybrand Bakker <postmaster_at_sybrandb.demon.nl>
Date: Mon, 6 Dec 1999 20:07:00 +0100
Message-ID: <944507262.2728.0.pluto.d4ee154e@news.demon.nl>


It does
There are two other ways to resolve it
update table1 t1
where (t1.rec_id, t1.rec_date)
in
(select rec_id, rec_date
  from table2)
And (assuming there is a concatenated index on rec_id and rec_date) update table1 t1
where exists
(select 'x'
  from table2 t2
  where t2.rec_id = t1.rec_id
   and t2.rec_date = t1.rec_date)

Hth,

--
Sybrand Bakker, Oracle DBA
Greg Akins <gakinsNOgaSPAM_at_gatewayhealthplan.com.invalid> wrote in message news:09920fb9.06801268_at_usw-ex0102-013.remarq.com...
> Hi,
>
> I have a query which is updating one field in a record, if two fields
> in that record match 2 fields in a record of another table.
>
> Basically:
>
> update table1 t1 set column_a = 1
> where T1.rec_id in (select rec_id from table2 t2
> where t1.rec_id = t2.rec_id )
> and t1.rec_date in (select rec_date from table2 t2
> where t1.rec_Date = t2.rec_Date)
>
> Does this do what I expect it to? Is there a cleaner way to accomplish
> this?
>
> Any help would be appreciated.
>
> -greg
>
>
> * Sent from RemarQ http://www.remarq.com The Internet's Discussion Network
*
> The fastest and easiest way to search and participate in Usenet - Free!
>
Received on Mon Dec 06 1999 - 13:07:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US