I'm using mysql5.0.32/php5.2.0-8, trying to get 2 tables echo'd out
together and ordered by their time columns. column_id and column_id
are the primary keys for each table. The data type is the same for
each of the tables and looks like:

table1(column_id, time)
table2(column_id, time)

I've tried doing a UNION ALL between the sql statements, but have not
been successful getting everything ordered by time.

<?php
include("config.php");
$sql = "(SELECT column_id, time FROM table1) UNION ALL (SELECT
column_id, time FROM table2) ORDER BY time DESC";
$query = mysql_query($sql);

while($row = mysql_fetch_array($query)) {
echo $row['column_id'] . '&nbsp;' . $row['time'] . '<br>';
}
?>

This continues to echo all rows from each table, but does not put
everything in descending order by time. If you know how this can be
done, please help. Thanks!


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to