Read my last post and then run SELECT VERSION() in MySQL. I really doubt you're running 4.0.
---John Holmes... > -----Original Message----- > From: Stephen [mailto:webmaster@;melchior.us] > Sent: Wednesday, November 06, 2002 9:57 PM > To: PHP List > Subject: Re: [PHP] Getting Newest > > Oh, well, now I'm getting this error: > > You have an error in your SQL syntax near 'union select * from church > union > select * from misc order by date desc limit 1' at line 1 > > Here's what I did for the SQL > > $sql = "select * from school union "; > $sql .= "select * from church union "; > $sql .= "select * from misc order by date desc limit 1"; > > > ----- Original Message ----- > From: "John W. Holmes" <[EMAIL PROTECTED]> > To: "'Stephen'" <[EMAIL PROTECTED]>; "'PHP List'" > <[EMAIL PROTECTED]> > Sent: Wednesday, November 06, 2002 9:43 PM > Subject: RE: [PHP] Getting Newest > > > > 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 > > > > > > > -- > 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