Subqueries using SQL derived tables  Unions in subqueries

Chapter 9: SQL Derived Tables

Unions

A union clause is allowed within a derived table expression. For example, the following query yields the contents of the stor_id and ord_num columns of both the sales and sales_east tables:

select * from
   (select stor_id, ord_num from sales
    union
    select stor_id, ord_num from sales_east)
dt_sales_info

Here, the union of two select operations defines the SQL derived table dt_sales_info.





Copyright © 2005. Sybase Inc. All rights reserved. Unions in subqueries

View this book as PDF