Re: Select Last X rows

2007-06-30 Thread Andrew Hutchings
Rich wrote: Ah that makes sense. It's a double shot, first grabbing the necessary records, then selecting all in that temp value (hitlist) in reverse order. Well done. Cheers On Jun 30, 2007, at 11:26 AM, Octavian Rasnita wrote: Hi, Try something like this: select * from (select * from t

Re: Select Last X rows

2007-06-30 Thread Rich
Ah that makes sense. It's a double shot, first grabbing the necessary records, then selecting all in that temp value (hitlist) in reverse order. Well done. Cheers On Jun 30, 2007, at 11:26 AM, Octavian Rasnita wrote: Hi, Try something like this: select * from (select * from table_name

Re: Select Last X rows

2007-06-30 Thread Rich
On Jun 30, 2007, at 9:06 AM, Borokov Smith wrote: Hey, Why is ORDER BY in combination with LIMIT not a valid solution to your problem ? Greetz, Hi there. Because if I choose ASC it chooses the first X records, and if I choose DESC it chooses the last X records, but in reverse order.

Re: Select Last X rows

2007-06-30 Thread Octavian Rasnita
Hi, Try something like this: select * from (select * from table_name where ... order by last_update desc limit 10) as tbl order by tbl.last_update; Octavian - Original Message - From: "Rich" <[EMAIL PROTECTED]> To: "Submit MySQL" Sent: Saturday, June 30, 2007 3:45 PM Subject: Sele

Re: Select Last X rows

2007-06-30 Thread Borokov Smith
Rich schreef: Hi folks. Just wanting to know the best way to grab the last 10 rows from a table. Looking twice to the db to see how many records there are will be outdated by the time the SELECT is done, so it's moot. This is a fast moving db with records coming and going. Instead of havi