Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How To Update 3 tables Simultaneouly through one query

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
Ankur_bhargava

New User


Joined: 18 Jul 2011
Posts: 2
Location: India

PostPosted: Mon Jul 18, 2011 7:47 pm    Post subject: How To Update 3 tables Simultaneouly through one query
Reply with quote

Hi All,

I have 3 separate queries to update fields in 3 different tables.But my requirement is, i want to update all 3 tables simultaneouly by single query.I tried to join 3 tables with a common field on all,and tried to update the fields on all 3 tables ( Fields are different in all tables ) .But it's not working.Anyone please help me on this. icon_confused.gif
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 18, 2011 7:58 pm    Post subject:
Reply with quote

Hello and welcome to the forum,

Do NOT post "it didn't work". . . This is a completely wasted post as it tells us nothing icon_sad.gif

If the columns are different in all 3 tables, how might there be a join - makes no sense icon_confused.gif

Why is there an issue with multiple queries to update multiple sets of unrelated data?
Back to top
View user's profile Send private message
Ankur_bhargava

New User


Joined: 18 Jul 2011
Posts: 2
Location: India

PostPosted: Mon Jul 18, 2011 8:34 pm    Post subject: Reply to: How To Update 3 tables Simultaneouly through one q
Reply with quote

Thanks for giving Reply,
But as per my thinking why to run 3 separate queries if possible to do the same work in single query.
I don't have any idea whether this is possible or not but just tried to get the best possible. ( can we use Temporary Table or Cursor to do the same )
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1771
Location: Bloomington, IL

PostPosted: Mon Jul 18, 2011 8:37 pm    Post subject: Re: Reply to: How To Update 3 tables Simultaneouly through o
Reply with quote

Ankur_bhargava wrote:

I don't have any idea whether this is possible or not but just tried to get the best possible.

So now that you've been told that it is not possible you'll devote your energies to more productive endeavors, yes?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Jul 18, 2011 8:42 pm    Post subject:
Reply with quote

Hello,

Quote:
But as per my thinking why to run 3 separate queries if possible to do the same work in single query.
Suggest you totally change your thinking. . .

There is no good reason to do unrelated "things" in the same query. . .

Actually, there are good reasons (which should be obvious) NOT to do unrelated things in a query. . .
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 Identify top 30 big tables or indexes... ashek15 DB2 0 Fri Jun 16, 2017 10:01 am
No new posts Need DB2 query to fetch previous row ! Chandan1993 DB2 10 Sat Jun 03, 2017 10:43 am
No new posts Fileaid Update Replace with null string descann Compuware & Other Tools 4 Mon May 15, 2017 3:00 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Data replication from multiple Db2 ta... kishpra DB2 9 Mon Mar 27, 2017 9:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us