List:General Discussion« Previous MessageNext Message »
From:Martin Ramsch Date:September 29 1999 8:03am
Subject:Re: Getting the last 10 rows instead of the 10 first ones?
View as plain text  
On Wed, 1999-09-29 04:48:23 +0000, Alex van Es wrote:
> Maybe not really a mysql related question.. but I hope one of you guys
> can help me out.. does anyone know a select statement that would give
> me the last 10 rows of a table, instead of using 'limit' giving me the
> first 10 ones?

Two suggestions:
- Either just sort the result in reverse order, and use LIMIT 10.
- Or determine the total number of rows first
  (e.g. with SELECT COUNT(*) ...), and use LIMIT $num-10,10

Regards,
  Martin
-- 
Martin Ramsch <m.ramsch@stripped> <URL: http://home.pages.de/~ramsch/ >
PGP KeyID=0xE8EF4F75 FiPr=52 44 5E F3 B0 B1 38 26  E4 EC 80 58 7B 31 3A D7
Thread
Getting the last 10 rows instead of the 10 first ones?(Alex)29 Sep
  • Re: Getting the last 10 rows instead of the 10 first ones?Martin Ramsch29 Sep
  • Re: Getting the last 10 rows instead of the 10 first ones?Bob Kline29 Sep