| List: | General Discussion | « Previous MessageNext Message » | |
| From: | Peter Lauri | Date: | September 15 2006 10:03am |
| Subject: | RE: How to sort last n entries? | ||
| View as plain text | |||
CREATE TEMPORARY TABLE tabletemp SELECT * FROM table ORDER BY id DESC LIMIT 30; SELECT * FROM tabletemp ORDER BY date; -----Original Message----- From: Dominik Klein [mailto:dk@stripped] Sent: Friday, September 15, 2006 4:45 PM To: mysql@stripped Subject: Re: How to sort last n entries? Peter Lauri schrieb: > SELECT * FROM table WHERE id=(SELECT id FROM table ORDER BY id DESC) ORDER > BY date This does not limit it to n entries (order by date limit n is not sufficient as I need last (highest) n ids). And afaik, limit is not allowed in sub-queries. -- 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 Klein | 15 Sep |
| • Re: How to sort last n entries? | Chris Sansom | 15 Sep |
| • Re: How to sort last n entries? | Dominik Klein | 15 Sep |
| • Re: How to sort last n entries? | Martijn Tonies | 15 Sep |
| • RE: How to sort last n entries? | Peter Lauri | 15 Sep |
| • RE: How to sort last n entries? | Peter Lauri | 15 Sep |
| • Re: How to sort last n entries? | Dominik Klein | 15 Sep |
| • RE: How to sort last n entries? | Peter Lauri | 15 Sep |
| • RE: How to sort last n entries? | Peter Lauri | 15 Sep |
| • Re: How to sort last n entries? | Brent Baisley | 15 Sep |
