Update only a row with a changed value in it

From: Robertson Lee - lerobe <Lee.Robertson_at_acxiom.com>
Date: Fri, 9 Dec 2011 17:15:01 -0000
Message-ID: <F1A191B056E5E04EA2134D842F9396F8284F2C1F_at_sunmsx01.Corp.Acxiom.net>



Guys,  

Got something I think I need a bit of a hand on.....  

I have two tables, say, TableA and TableB J  

Table A


ID varchar2(10),

DT_CONTACT date,

BUILD number  

Table B


ID varchar2(10),

DT_CONTACT date  

I need to update Table A as follows  

Update table A

Set dt_contact = least(a.dt_contact,b.dt_contact)

      Build = (select variable from another table where stage = 'BUILD') - this step not key dependant

Where the individual id on tableA = the individual_id on table B  

This only needs to occur if the date on table A is going to change and also avoid the godawful returning more than one row thing  

Does that all make sense. Its doing my head in.......  

Hope someone can point me in the right direction and have a great weekend.  

Cheers  

Lee



The information contained in this communication is confidential, is intended only for the use of the recipient named above, and may be legally privileged.

If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.

If you have received this communication in error, please resend this communication to the sender and delete the original message or any copy of it from your computer system.

Thank You.


--
http://www.freelists.org/webpage/oracle-l
Received on Fri Dec 09 2011 - 11:15:01 CST

Original text of this message