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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Update a Table from a Second Table

Re: Update a Table from a Second Table

From: programmer <int.consultNOCAPITALS_at_macmail.com>
Date: Mon, 30 Jun 2003 11:15:56 +0100
Message-ID: <bdp33l$osb$1@pheidippides.axion.bt.co.uk>


> I second the comments of Daniel Morgan. Almost everyone here exposed to
> SQLserver starts asking questions in any (and too frequently:in all)
Oracle
> newsgroups, prior to doing the RTFM routine.
>
> As to your question
> update table1 a
> set table1.col2 = (select col2 from table2 where table2.keycol =
> a.keycol)
> where exists
> (select 'x'
> from table2
> where keycol = a.keycol
> )
>
> Is that sooo difficult? IMO it is not.
> Also in 8i and higher you can
>
> update
> (select table2.col2
> from table1, table2
> where table1.keycol = table2.keycol
> )
> set table1.col2 = table2.col2
>
> And of course that is documented, it only requires a little RTFM
>
> Something most SQLserver people are obviously not prepared to.
>
>
> --
> Sybrand Bakker
> Senior Oracle DBA
>
> to reply remove '-verwijderdit' from my e-mail address
>

Thanks for that answer, I've always wondered how you do that in Oracle (I'm not from a SQLServer background). I wonder if anything like that is possible in MySQL. Received on Mon Jun 30 2003 - 05:15:56 CDT

Original text of this message

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