Click to See Complete Forum and Search --> : MySQL LIMIT clause problem


Shaolin
02-16-2009, 06:58 PM
Hi Guys
I am trying to select a range of results using the LIMIT clause but its does not work. See below:

SELECT *, DATE_FORMAT(last_modified,'%d/%b/%Y') AS formatted_last_modified FROM mail WHERE user_id=1 AND is_draft='1' ORDER BY last_modified DESC LIMIT 50,100;
As you can see, I am requesting all records between 50 and 100, but the query returns ALL the current records which is from record 1 to 59. Does anyone know why this is happening ?

chazzy
02-16-2009, 07:57 PM
I am requesting all records between 50 and 100

No, you are requesting results starting at the 51st record and up to 100 results. This should be giving you results 51-150.

as for why, i can't really explain without more information. are there in fact only 59 rows in the table with the applied where clause? what happens if you take out the date_format?