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

Update table to swap the valus of 'c' and 'd'


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

New User


Joined: 26 Apr 2007
Posts: 49
Location: Delhi

PostPosted: Fri Aug 17, 2007 4:40 pm
Reply with quote

I have a table with Clumns a,b,c,d,e and date-timestamp. I need to swap the valus of 'c' and 'd' when Date-timestamp <= '2005-05-13-00.00.00.000000'.

All th 5 columns (a,b,c,d,e) make composite primary ky. I need to do it through sql query

Can ne1 pleas hlp me.

Thanks in advance
Back to top
View user's profile Send private message
Prajesh_v_p

Active User


Joined: 24 May 2006
Posts: 133
Location: India

PostPosted: Fri Aug 17, 2007 5:14 pm
Reply with quote

Can you try out this one?

update table t1 set c = (select d from tabel t2
where t2.a = t1.a
and t2.b = t1.b
and t2.c = t1.c
and t2.d = t1.d ),
d = (select d from tabel t3
where t3.a = t1.a
and t3.b = t1.b
and t3.c = t1.c
and t3.d = t1.d ),
where t1.timestamp <= '2005-05-13-00.00.00.000000'

Thanks,
Prajesh
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Aug 23, 2007 5:17 am
Reply with quote

apparently the OP never did.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Load new table with Old unload - DB2 DB2 6
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Multiple table unload using INZUTILB DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Dynamically pass table name to a sele... DB2 2
Search our Forums:

Back to Top