with this code I select the first 30 row of the table:
SELECT * FROM `table` LIMIT 0 , 30
But how to select the last 30, without changing the order?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It looks like everyone is missing this part:
First of all, clearly there is no order in the query provided. Assuming the order is ascending on some field this would be the query @DannyFox meant:
Now imagine we have simplified data, such as
a, b, c, d, eand that we want only 3 rows instead of 30:If this returns:
a, b, c, d, ein each row, then he would expect to getc, d, ein that order. The query everyone is providing:Would return
e, d, c. The problem with this is that it’s actually changing the original order, and the OP say he didn’t want to change the order. So technically, the query that would result inc, d, eis:Which actually changes the order twice, getting the original order back.