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
e 30, 2007 3:45 PM Subject: Select Last X rows 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

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

Select Last X rows

2007-06-30 Thread Rich
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 having an offset