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: SQL help required for a brain not working too well today

Re: SQL help required for a brain not working too well today

From: Michael Serbanescu <mserban_at_postoffice.worldnet.att.net>
Date: 1998/02/20
Message-ID: <6cjdh0$gdo@bgtnsc01.worldnet.att.net>#1/1

Try this:

UPDATE T1 a
SET a.col1=(SELECT b.newcol1 FROM T2 b WHERE b.UnqKey1=a.UnqKey1), col3=(SELECT b.newcol3 FROM T2 b WHERE b.UnqKey1=a.UnqKey1), col7=(SELECT b.newcol7 FROM T2 b WHERE b.UnqKey1=a.UnqKey1) WHERE a.UnqKey1 IN (SELECT UnqKey1 FROM T2);

Hope this helps.

Michael Serbanescu



Bob Johnson wrote:
>
> HELP !!
>
> My brain seems to have stopped working.
>
> I have a table T1 with the columns UnqKey1, col1, col2, col3, col4,
> col5, col6, col7. The table contains 1 million rows
>
> and I have table T2 with the columns UnqKey1, newcol1, newcol3, newcol7.
> This table contains 100 rows (of updated info).
>
> What is the most efficient way of updating T1 such that col1 is set to
> newcol1, col3 set to newcol3 and col7 set to newcol7 where the keys
> match.
>
> Thanks in advance, post to the newsgroup only please.
Received on Fri Feb 20 1998 - 00:00:00 CST

Original text of this message

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