Prova detta i SP
SET @String1 = concat(concat(concat(concat("SELECT field1,field2 FROM table1 WHERE field3 = ",sp_var1," && field4 = "),sp_var2," LIMIT "),sp_Var_skip,","),sp_var_count);
PREPARE Stmt FROM @String1;
EXECUTE Stmt;
SET @String1 = ""
Alternativt
DELIMITER $
CREATE PROCEDURE `tmp`()
BEGIN
PREPARE STMT FROM "SELECT * FROM users LIMIT ?,?";
END$
DELIMITER;
SET @a=2;
SET @b=1;
CALL tmp();
EXECUTE STMT USING @a, @b;
Mer information om detta här