John John - 1 year ago 93
PHP Question

Sort records from different tables

I have two table with an column 'minute'.
These table are joined with a INNER JOIN.
Now I want to print out all the records from both tables sorted on both the columns 'minute'


Table 1: name - minute

John - 1
Marc - 3

Table 2: name - minute

Gareth - 2
Joe - 3


John, Gareth, Marc, Joe

The two tables have to remain two separate tables.

Answer Source

You should use UNION :-

 FROM    table1)
 FROM    table2)

 ORDER BY minute ASC


john    1
gareth  2
marc    3
joe     3
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download