Re: Getting Newest
| From: | Miles Thompson | Date: | Thu, 07 Nov 2002 20:59:09 +0000 |
| Subject: | Re: Getting Newest | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123231@lists.php.net to get a copy of this message | ||
Lighten up! Participation here is voluntary.
Maxim gave you a good answer, as you provided no information about the table structure. I'd be wondering why you are using three tables, but that's probably another discussion. Based on what he gave you, and a little study you should be able to figure it out, otherwise query each table in turn & pick the most recent according to whatever criteria you use.
Have an index on the field which determines "most recent", check the max() function and side effects it may have on query speed.
Cheers - Miles Thompson
PS Why do you have three tables - is your data fully normalized?
At 03:19 PM 11/7/2002 -0500, Stephen wrote:
Did you not read what I asked? I have three tables, I need to get the newest from whichever table has the newest piece of content. ----- Original Message ----- From: "Maxim Maletsky" <maxim@php.net> To: "Stephen" <webmaster@melchior.us> Cc: "PHP List" <php-general@lists.php.net> Sent: Thursday, November 07, 2002 12:46 PM Subject: Re: [PHP] Getting Newest SELECT * FROM table ORDER BY date DESC -- Maxim Maletsky maxim@php.net "Stephen" <webmaster@melchior.us> wrote... :Sorry, I'm using MySQL. ----- Original Message ----- From: "Marco Tabini" <marcot@inicode.com> To: "Stephen" <webmaster@melchior.us> Cc: "PHP List" <php-general@lists.php.net> Sent: Wednesday, November 06, 2002 4:00 PM Subject: Re: [PHP] Getting Newest-------------------------------------------------------------------------- --That depends on what DBMS you are using. Which one is it? Marco -- ------------ php|architect - The magazine for PHP Professionals The first monthly worldwide magazine dedicated to PHP programmer Come visit us at http://www.phparch.com!------ 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