This code doesn't work
select pagenr into @offset from pages where id = 3;
select * from table1 limit @offset*10, 10;
What SQLcode do I need to use in order to get this kind of code to work
using only SQL!
Note that
SET SQL_SELECT_LIMIT = @count
doesn't work because I'm mainly concerned with the offset, not the limit as such.
From the MySQL 5.5 specification:
So, inside a stored procedure, the following would work:
Otherwise, you'll need to precompute the value and pass it in via the query. You should already know the page size and page number, so this shouldn't be difficult.