If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > how to create view for more than 3 tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-25-08, 06:04
rameshj6 rameshj6 is offline
Registered User
 
Join Date: Oct 2008
Posts: 51
Cool how to create view for more than 3 tables

Hello,

how to create view for more than 3 tables
Reply With Quote
  #2 (permalink)  
Old 11-25-08, 08:34
tonkuma tonkuma is offline
Registered User
 
Join Date: Feb 2008
Location: Japan
Posts: 2,193
JOIN them or UNION/UNION ALL them in your view definition. (There would be some more ways.)
Reply With Quote
  #3 (permalink)  
Old 11-26-08, 00:36
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
please specify what you exactly require....how to create view for more than 3 tables is a pretty open ended question which will result in more answers which will not satisfy your requirement....
__________________
IBM Certified Database Associate, DB2 9 for LUW
Reply With Quote
  #4 (permalink)  
Old 11-27-08, 02:27
Peter.Vanroose Peter.Vanroose is offline
Registered User
 
Join Date: Sep 2004
Location: Belgium
Posts: 1,079
Quote:
Originally Posted by rameshj6
how to create view for more than 3 tables
If your question is "what is the JOIN syntax for three tables", I can answer that:
Code:
CREATE VIEW v AS
(SELECT a.x, b.y, ......
 FROM   tbla A INNER JOIN tblb B ON a.xx = b.xx
                    INNER JOIN tblc C ON a.yy = c.yy
 WHERE  additional-condition(s)
 ...
)
Or with "INNER" replaced by "LEFT OUTER" or "RIGHT OUTER" or "FULL OUTER", of course.
Adding a 4th etc. Table should be obvious now.
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On