Row Expressions

Row expressions are an extension to predicates. They allow more than one set of comparisons in a single predicate using a subquery that returns more than one column and even more than one row. This predicate will be true when all three columns on the left equal the three values in any single row returned in the result set from the subquery. This will also allow the use of quantified predicates with row expressions.

SELECT * FROM TABLE
WHERE (COL1, COL2, COL3) IN
   (SELECT COLA, COLB, COLC
    FROM TABLE
    UNION ALL
    SELECT COLX, COLY, COLZ
    FROM ANOTHER_TABLE)

Get DB2® Universal Database for OS/390® Version 7.1 Certification Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.