Re: Getting Newest

From: Date: Thu, 07 Nov 2002 02:33:13 +0000
Subject: Re: Getting Newest
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-123094@lists.php.net to get a copy of this message
So for my SQL statement I put this? $sql = "select id, date, name, text from table1 union"; $sql2 = "select id, date, name, text from table2 union"; $sql3 = "select id, date, name, text from table3 order by date desc"; ----- Original Message ----- From: "Nick Eby" <nick_eby@bonzidev.com> To: <php-general@lists.php.net> Sent: Wednesday, November 06, 2002 7:57 PM Subject: Re: [PHP] Getting Newest > you could make a union of all the records, and order by newest date first: > > (select id, date, name, text from table1) union > (select id, date, name, text from table2) union > (select id, date, name, text from table3) order by date desc > > then select the first record > /nick > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.general (#123094) next »