Thread: Ordering union
View Single Post
Old 02-04-2013, 09:09 PM   PM User | #4
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,210
Thanks: 59
Thanked 3,996 Times in 3,965 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You don't need to add a column to the tables. Just add it to the UNION.

If that's what you meant, then that is the correct way to do it.
Code:
SELECT 0 as tablenumber, `order`, FROM all_child_fields WHERE editible='1' 
UNION 
SELECT 1, `order`, field_name FROM a_child_fields WHERE editible='1' 
ORDER BY tablenumber, `order`
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote