TABLE 1
id time1 info
1 110 info1
2 120 info2
TABLE 2
id time2 info
1 100 info3
2 130 info4
How could I pull data from both tables at once and order by time1 and time2 (same thing, but the fields have different names)
Expected result row ids:
1 // table 2
1 // table 1
2 // table 1
2 // table 2
You should use
UNION JOINqueries, alias the common sorting columns (time1 and time2) to have the same name and sort the entire reunited result-set.Unfortunately this means not being able to return different table structures per table. They Have to match regarding number of columns and such.
A workaround would be something like this: