Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Update table to swap the valus of 'c' and 'd'

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Update table to swap the valus of 'c' and 'd'
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    Post subject: Reply to: Update table to swap the valus of 'c' and 'd'
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: 6968
Location: porcelain throne

PostPosted: Thu Aug 23, 2007 5:17 am    Post subject: Reply to: Update table to swap the valus of 'c' and 'd'
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Table(Unicode(Graphic) table) loading... muralikrishnan_new DB2 0 Thu Oct 05, 2017 5:10 pm
No new posts Insert a Row_number into table useit DB2 2 Tue Sep 19, 2017 1:07 pm
No new posts how to see when the last read access ... Mike 1304 DB2 1 Tue Sep 12, 2017 7:52 pm
No new posts PC (UTF-8) -> z/OS (EBCDIC) -> ... prino All Other Mainframe Topics 4 Fri Sep 01, 2017 1:47 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us