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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: UPDATE

Re: UPDATE

From: <PK_Deepa/VGIL_at_vguard.satyam.net.in>
Date: Wed, 23 Oct 2002 07:15:29 -0800
Message-ID: <F001.004F0FA2.20021023071529@fatcity.com>


 Try this
update x z set id2 = (select id2 from a where z.id1=id1 and id2<>0) where id2=0;

Deepa

|--------+----------------------->

| | Imran Ashraf |
| | <imran9a_at_yaho|
| | o.com> |
| | |
| | 23/10/2002 |
| | 03:03 PM |
| | Please |
| | respond to |
| | ORACLE-L |
| | |
|--------+-----------------------> >--------------------------------------------------------| | | | To: Multiple recipients of list ORACLE-L | | <ORACLE-L_at_fatcity.com> | | cc: (bcc: PK Deepa/VGIL) | | Subject: UPDATE | >--------------------------------------------------------|

Hi,

I have table x with 2 columns:

ID1 ID2
---- ----

1      0
1      5
2      0
2      10

I want to update ID2, set the 0s to the other value for the same ID1. So, i would have:

ID1 ID2
---- ----

1      5
1      5
2      10
2      10

Whats the best way to do this?

Thanks.



Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site http://webhosting.yahoo.com/
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Imran Ashraf
  INET: imran9a_at_yahoo.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: PK_Deepa/VGIL_at_vguard.satyam.net.in

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Wed Oct 23 2002 - 10:15:29 CDT

Original text of this message

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