MySQL: getting latest record
| From: | ShortStay | Date: | Sun, 14 Dec 2003 15:47:02 +0000 |
| Subject: | MySQL: getting latest record | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-32033@lists.php.net to get a copy of this message | ||
My application is that I am getting the latest quote for a price where more
than one quote may have been made.
I've got a timestamp colum and I want to get the latest record where certain
columns have certain values. Eg
SELECT * FROM MyTable WHERE Field1='test' ...? something about the
timestamp
I may also have an OR in the condition, like WHERE Field1='test1' OR
Field2=test2'... 'test1' and test2' would be different products.
Do I have to use ASCending or DESCending on the timestamp column and LIMIT?
Never done this before so suggestions gratefully received.
Thanks,
John