I am trying this code to use LIMIT in MYSQL with a variable. When I use a simple number for LIMIT it works fine but when I use a variable then it's not working.
SET @increment:=9;
SET @number:=1;
SET @end:=10*@number;
SET @start:=@end-@increment;
SELECT name, detail FROM tab1 LIMIT @start, @end;
When I use the below code (no variable) it works fine:
SELECT name, detail FROM tab1 LIMIT 0,10;
