If you execute this query
SELECT 'test-a1' AS name1, 'test-a2' AS name2
the result will be a one row-selection with two columns having these values:
test-a1, test-a2
How can I modify the above query to have a selection with several rows, e.g.
test-a1, test-a2 test-b1, test-b2 test-c1, test-c2
I know how to do this with UNION but I feel that there exists a more simple way to do it.
PS. Sorry for such a basic question, it is very hard to google it.
Advertisement
Answer
UNION ALL is the best bet. It’s faster than UNION and you will have mutually exclusive rows.