I would like to run two select statements for two different tables but list them in one loop. Currently I run them independently but this is not ideal as i would like the records listed in date order as a whole. The column names and column numbers are different.
Simplified Current setup
$SQL = "SELECT * FROM table1 WHERE colA IS NOT NULL ORDER BY dateA";
$DataOne = mysql_query($SQL);
$SQL = "SELECT * FROM table2 WHERE colZ IS NOT NULL ORDER BY dateZ";
$DataTwo = mysql_query($SQL);
while ($row = mysql_fetch_assoc($DataOne)) {
echo "<td>$row[colA]</td>";
}
while ($row = mysql_fetch_assoc($DataTwo)) {
echo "<td>$row[colZ]</td>";
}
Desired setup (logically)
while ($row = mysql_fetch_assoc($DataOne, $DataTwo)) {
// all returned rows from both tables in date order
echo "<td>$row[EitherCol]</td>";
}
INFO: I understand i should be using mysqli or pdo but it isn't an option at the moment