December 2005
Intermediate to advanced
336 pages
4h 52m
English
In this chapter you’ll learn how to use the UNION operator to combine multiple SELECT statements into one result set.
Most SQL queries contain a single SELECT statement that returns data from one or more tables. MySQL also enables you to perform multiple queries (multiple SELECT statements) and return the results as a single query result set. These combined queries are usually known as unions or compound queries.
There are basically two scenarios in which you’d use combined queries:
To return similarly structured data from different tables in a single query
To perform multiple queries against a single table returning the data as one query
Combining Queries and Multiple WHERE Conditions ...
Read now
Unlock full access