Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2008
    Posts
    82

    Cool Unanswered: how to create view for more than 3 tables

    Hello,

    how to create view for more than 3 tables

  2. #2
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    JOIN them or UNION/UNION ALL them in your view definition. (There would be some more ways.)

  3. #3
    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

  4. #4
    Join Date
    Sep 2004
    Location
    Belgium
    Posts
    1,126
    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/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •