View Single Post

   
  #4 (permalink)  
Old 02-27-2008, 09:16 PM
Peter Lauri
 
Posts: n/a
Default RE: How to sort last n entries?

SELECT * FROM table WHERE id=(SELECT id FROM table ORDER BY id DESC) ORDER
BY date

-----Original Message-----
From: Dominik Klein [mailto:dk@in-telegence.net]
Sent: Friday, September 15, 2006 3:41 PM
To: mysql@lists.mysql.com
Subject: How to sort last n entries?

I have a table with primary key "id". Another field is "date". Now I
want the last n entries, sorted by "date".

Is this possible in one SQL statement?

Thanks for your help
Dominik

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=lists@dwsasia.com

Reply With Quote