Difference between revisions of "UNION"
Jump to navigation
Jump to search
Line 8: | Line 8: | ||
<source lang=sql class='setup'></source> | <source lang=sql class='setup'></source> | ||
SELECT name FROM bbc WHERE name LIKE 'Z%' | SELECT name FROM bbc WHERE name LIKE 'Z%' | ||
UNION | UNION | ||
SELECT name FROM actor WHERE name LIKE 'Z%' | SELECT name FROM actor WHERE name LIKE 'Z%' | ||
</div> | </div> | ||
Revision as of 11:47, 10 September 2012
Make union between different tables to build one single view or results?
schema:gisq
List a number of SELECT statements separated by the UNION key word. Be sure that you have the same number of columns in each of the SELECT statements.
SELECT name FROM bbc WHERE name LIKE 'Z%' UNION SELECT name FROM actor WHERE name LIKE 'Z%'