Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Creating a search form that uses multiple checkboxes


swa66 - 6:08 pm on Nov 20, 2012 (gmt 0)


Regardless you could always include an additional column you add the select it came from and then sort on that, SQL is a fully featured language. Most you can imagine to do can be done in one (complex) query.

Actually the docs state the approach by adding a column to indicate what select the row comes from


To cause rows in a UNION result to consist of the sets of rows retrieved by each SELECT one after the other, select an additional column in each SELECT to use as a sort column and add an ORDER BY following the last SELECT:


(SELECT 1 AS sort_col, col1a, col1b, ... FROM t1)
UNION
(SELECT 2, col2a, col2b, ... FROM t2) ORDER BY sort_col;

Quoted from [dev.mysql.com...]


Thread source:: http://www.webmasterworld.com/php/4520722.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com