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

Home -> Community -> Usenet -> c.d.o.tools -> Re: update based on join

Re: update based on join

From: Marc Billiet <someone.overthere_at_living>
Date: Mon, 02 Oct 2000 05:38:38 GMT
Message-ID: <20001002.5383849@slu40xxx.hae.hydro.com>

Hm,

update girls set bra = 'C' where friend = 'James' ?

Marc

>>>>>>>>>>>>>>>>>> Oorspronkelijk bericht <<<<<<<<<<<<<<<<<<

Op 2000-10-01, 17:53:58, schreef "James Pugh" <james pugh_at_mindspring.com
>

over het thema update based on join:

> Forgive my sexist example. I'm working on a Sunday, so I made an examp
 le
> that amuses me.
 

> I want to update certain rows in a table based on a join to another

table.

> Here's the example and the SQL is used. Is there a better way to do th
e
same
> thing?
 

> SQL> describe boys
> Name Null? Type
> ----------------------------------------- -------- --------------
> NAME CHAR(30)
> LENGTH FLOAT(126)
 
> SQL> describe girls
> Name Null? Type
> ----------------------------------------- -------- --------------
> NAME CHAR(30)
> FRIEND CHAR(30)
> BRA CHAR(3)
 
> SQL> select * from boys;
 

> NAME LENGTH
> ------------------------------ ----------
> James 9
> Ron 10
> Todd 10
> Jeremy 10
 

> SQL> select * from girls;
 

> NAME FRIEND BRA
> ------------------------------ ------------------------------ ---
> Karen James C
> Trish Todd A
> Val Todd A
> Tiffany James C
> Misty James C
 

> SQL>
> update girls z set bra = 'C' where (select a.name from boys a, girls
 b
where
> b.name = z.name and a.name = b.friend)='James';
 

> The update changes the bra size for all girls with 'James' as a friend
. Received on Mon Oct 02 2000 - 00:38:38 CDT

Original text of this message

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