I have a table of 1000 records of data. If i want to get data of rows from 501 to 700 from the table without using any condition what I have to do.Please suggest a solution.
Asked
Active
Viewed 6,179 times
-5
-
1Which SQL version are you using? I am guessing MySQL? – Sparky Oct 15 '14 at 10:15
-
see also: http://stackoverflow.com/questions/1876606/how-to-select-bottom-most-rows . You should be able to do it in two passes: first pass to select top, second pass to select bottom (or the reverse). – Rémi Oct 15 '14 at 10:16
-
Have you tried any thing? – Danilo Matrangolo Marano Mar 03 '21 at 16:02
1 Answers
6
I guess you can use LIMIT
like this :
SELECT * FROM my_table
LIMIT 500,200; -- get data of rows from 501 to 700
Moreover, you should not rely data to be sorted with primary key by default, so add an ORDER BY statement :
SELECT * FROM my_table
ORDER BY primary_key
LIMIT 500,200; -- get data of rows from 501 to 700
-
2
-
@techsolutions: don't forget to accept this answer, if it worked for you. To accept an answer, click on the 'tick' mark to the left, so it turns green. This is how we mark a question as solved here. – halfer Mar 30 '15 at 12:09