How to order by in union all query.
Simple union all
SELECT id, name FROM table_a
UNION ALL
SELECT id, name FROM table_b
Wrong Case
SELECT id, name FROM table_a ORDER BY name DESC
UNION ALL
SELECT id, name FROM table_b ORDER BY name DESC
Correct Case
SELECT id, name FROM table_a
UNION ALL
SELECT id, name FROM table_b
ORDER BY name DESC