Combine Multiple Resultsets: Use the Union Clause

Combining multiple resultsets is a bit of an advanced topic. However, the basics of what the Union clause does are easy to understand. The Union clause enables you to take two Select statements and combine them into one resultset. There are many times when you will need to use the Union clause. Consider the task of providing a consolidated list of clients. At first, the task may sound trivial, but in reality, it is not.

Earlier in this chapter, you were introduced to the Select statement. In the sample code, you were introduced to techniques that enabled you to extract client data from the Client table. In the case of individual clients, the client name is found in the first- and lastname fields. ...

Get Absolute Beginner’s Guide to Databases 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.