I am trying to create a SQL call that first order all the rows by date and returns all the rows starting from the number 25.
So far I have
"SELECT * FROM 'users' ORDER BY 'table'.'regdate' OFFSET 24"
But this is not working .. How can I do this ?
I am trying to create a SQL call that first order all the rows by date and returns all the rows starting from the number 25.
So far I have
"SELECT * FROM 'users' ORDER BY 'table'.'regdate' OFFSET 24"
But this is not working .. How can I do this ?
try like this:
first get count all data in table like this:
$count=select count(*) from users
then
SELECT * FROM 'users' ORDER BY 'table'.'regdate' limit 25,$count
There is nothing wrong with your query, the problem must be elsewhere.
Your query includes an offset which omits the first 24 results. This imposes no limits and should therefore return evrey row pat the 24 oldest dates. To omit the new dates instead you have to set your order as DESC
SELECT * FROM 'users' ORDER BY 'table'.'regdate' OFFSET 24
To do that and limit results to 100 records simply do this:
SELECT * FROM my_table ORDER BY date_field DESC OFFSET 24 LIMIT 100