SELECT and ORDER rows from multiple tables
Interesting problem brought up by Itosu. Basically, he had two tables,
called rfs and dfs, and both of them had a column called uname.
All he wanted to do was select all of rows from both tables and order them by
uname. After some research, this ended up being trivial:
SELECT * FROM rfs UNION ALL SELECT * FROM dfs ORDER BY uname ASC;
The ORDER BY takes effect on the entire union if it comes at the end. This is
very handy, and I have a feeling I will be referring back to it someday.


Comments are closed