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: 6970
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 Searching a table for the field name? socker_dad COBOL Programming 8 Sat Mar 31, 2018 2:57 am
No new posts Need inputs on DB2 tablespace/table r... ashek15 DB2 3 Sat Mar 24, 2018 11:49 pm
No new posts COBOL declaration for table Poha Eater DB2 3 Mon Feb 26, 2018 6:58 pm
No new posts Need Guidance regarding UPDATE query Poha Eater DB2 3 Mon Feb 12, 2018 11:35 pm
No new posts load and delete table through JCL wit... ram_vizag JCL & VSAM 9 Thu Feb 01, 2018 12:47 am

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