Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: no support for selecting from unions


    I use the db2 version V5R1M0 010525, DB2 UDB AS/400 .

    I cannot run a do a select statement on any union SQL query.
    Can someone tell me if this is a database limitation or if there is
    any option that has to be set to enable this feature.

    Also this db2 does not allow me to create views out of a
    SQL query that uses a Union.

    Could someone tell me how this can be overcome?

    Thanks & Reg,
    K Rajkumar

  2. #2
    Join Date
    May 2003
    I don't know much about DB2 for AS/400, or even what the current release number is, but on DB2 for Linux, Unix, and Windows you can put a UNION ALL in a view since at least version 7 (the current version is 8), and maybe earlier.

    But a UNION is not supported for views, only UNION ALL. Remember that a UNION tries to remove duplicate rows, and UNION ALL does not. Many times there are no duplicates to be removed and the UNION command is used inappropriately, when a UNION ALL would be better.

Posting Permissions

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