List:General Discussion« Previous MessageNext Message »
From:Peter Lauri Date:September 15 2006 9:30am
Subject:RE: How to sort last n entries?
View as plain text  
And if your MySQL version does NOT support sub queries you can probably just
create a temporary table and then sort that one.

/Peter

-----Original Message-----
From: Peter Lauri [mailto:lists@stripped] 
Sent: Friday, September 15, 2006 4:28 PM
To: mysql@stripped
Cc: dk@stripped
Subject: FW: How to sort last n entries?

Assuming your MySQL version supports sub queries you do like this. I have
never done sub queries my self, but I know the theory :)

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

/Peter Lauri

www.lauri.se - personal
www.dwsasia.com - company (Web Development Bangkok Thailand)

-----Original Message-----
From: Dominik Klein [mailto:dk@stripped] 
Sent: Friday, September 15, 2006 3:41 PM
To: mysql@stripped
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=1


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

Thread
How to sort last n entries?Dominik Klein15 Sep
  • Re: How to sort last n entries?Chris Sansom15 Sep
    • Re: How to sort last n entries?Dominik Klein15 Sep
  • Re: How to sort last n entries?Martijn Tonies15 Sep
  • RE: How to sort last n entries?Peter Lauri15 Sep
RE: How to sort last n entries?Peter Lauri15 Sep
Re: How to sort last n entries?Dominik Klein15 Sep
  • RE: How to sort last n entries?Peter Lauri15 Sep
  • RE: How to sort last n entries?Peter Lauri15 Sep
Re: How to sort last n entries?Brent Baisley15 Sep