UNION is implemented in MySQL 4.0.0, btw.

> -----Original Message-----
> From: Stephen [mailto:webmaster@;melchior.us]
> Sent: Wednesday, November 06, 2002 9:33 PM
> To: PHP List
> Subject: Re: [PHP] Getting Newest
> 
> 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" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> 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
> >
> >
> 
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to