IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to compare 2 tables and copy fields


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
chandracdac

New User


Joined: 15 Jun 2007
Posts: 92
Location: bangalore

PostPosted: Mon Aug 27, 2007 11:39 am
Reply with quote

Hai

I have a ssmall question. I have 2 tables which are identical. but in my second table some fields are empty .so i have to compare the two tables and
i have to copy the fields from 1st table to second one where ever the fields are empty .can u try? and pls tell me.
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Mon Aug 27, 2007 1:14 pm
Reply with quote

Hi Chandra,

Try this query

Code:
UPDATE Table1 A                   
SET A.Column1  = (SELECT B.Column1 FROM
Table B WHERE                     
A.PrimarykeyColumn =B. PrimarykeyColumn)                             
WHERE                                         
A.Column1 = ' ' 


Let me know if this works

Thanks
Sai
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Compare the member of two pds on las... DFSORT/ICETOOL 13
No new posts Question regarding ISPF tables with T... TSO/ISPF 11
No new posts DB2 Image Copy DFSMS MGMTCLAS Partial... DB2 2
No new posts To join 2 tables and to join 3rd tabl... DB2 8
No new posts Partial Sort conditions for PD fields DFSORT/ICETOOL 16
Search our Forums:


Back to Top