-ffs-AbodyRulez Posted August 23, 2015 Share Posted August 23, 2015 So i have this huge database, i want a dbExec command to select the first 5 rows on each time its called, 5 different rows of course, I've tried Limit, Count, not sure if MTA SQL has Row_number, but anyway, any ideas? Example: First call : row 1 row 2 row 3 row 4 row 5 Second Call: row 6 row 7 row 8 row 9 row 10 and so on Link to comment
JR10 Posted August 23, 2015 Share Posted August 23, 2015 For the first 5, append: "LIMIT 0, 5" For the second 5, append: "LIMIT 5, 5" The first one is the start at index, 0 is the first row, 5 is the 6th row. The second one is the number of rows to get. Link to comment
-ffs-AbodyRulez Posted August 23, 2015 Author Share Posted August 23, 2015 For the first 5, append: "LIMIT 0, 5"For the second 5, append: "LIMIT 5, 5" The first one is the start at index, 0 is the first row, 5 is the 6th row. The second one is the number of rows to get. Worked like charm!. However, if i wanted to iterate this, should i just increment both of numbers? Limit i+=5 , j+=5 ? EDIT: Figured it out, thanks, motshakkren ya '3ali Link to comment
JR10 Posted August 23, 2015 Share Posted August 23, 2015 You would increment the first number only, which controls the starting at index. You're welcome. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now