Jump to content

Archived

This topic is now archived and is closed to further replies.

nemethpeter

Help is needed in setting an interval

Recommended Posts

Hello!

 

THere\'s a table with say 5 columns and 60 rows. How can i make a SELECT query, that selects the rows between 20 and 30? (there are id-s in every rows, but as some are usually deleted, it cannot be said, that rows between the id-s 20 and 30) I know, that there\'s a phrase called \'BETWEEN\', but dunno how may i apply it when talkin about rows...

 

Bye

 

NP

Share this post


Link to post
Share on other sites

Maybe you can run a loop count each row and tell it to display 20-30?

 

try http://www.mysql.com and run a search there, that site will tell you everything you could ever want to know in plain english, best sitre ever.

Share this post


Link to post
Share on other sites

Ya know, the problem is, that some rows might be deleted (just as i said) and the id-s may come like 1,3,4,5,8,10 and in this way saying that \"where id BETWEEN 1 and 10\" certainly doesn\'t produce 10 rows of data.

However, recently I\'ve heard that all rows should be processed, and in the array just the surplus should be deleted... What do you think?

 

Thanks for the answers:

 

NP

Share this post


Link to post
Share on other sites


SELECT * FROM table ORDER BY id LIMIT 10 OFFSET 20;

 

will return 10 records starting from record number 20...

 

P.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.