I'm new to databases, and im not sure why this isnt working.
My objective is to get all the users in a database except the first one. I would also like this to be sortable, so it contains ORDER BY.
I finally got pagination to work, but the query is returning overlapping results on different pages
QUERY:
SELECT * FROM `users` as `User` WHERE '1'='1' AND `User`.`id` > '1' ORDER BY User.active ASC LIMIT 0, 10
i get these back (here is their IDs in the order i got) 32,18,19,16,15,14,13,12,11,2
Now with the LIMIT part set to 10,100, i get these back 32,20,19,2,11,12,13,14,15,15
I'm not sure why i get overlapping results. Help?
Thanks :)
Try this:
SELECT * FROM users as User WHERE '1'='1' AND User.id > 1 ORDER BY User.id ASC LIMIT 0,10
OR TRY something simple:
SELECT * FROM users WHERE users.id > 1 LIMIT 0,10
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments