Click here to Skip to main content
15,888,254 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have made customer table no problem in that.
mysql> SET @pageno = 2;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from customer limit 2 offset (limit)*(@pageno-1);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(limit)*(@pageno-1)' at line 1

What I have tried:

mysql> SET @pageno = 2;
Query OK, 0 rows affected (0.00 sec)

mysql> select * from customer limit 2 offset (limit)*(@pageno-1);
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(limit)*(@pageno-1)' at line 1
Posted
Updated 27-Feb-22 0:52am

1 solution

I do not think that the expression (limit)*(@pageno-1) is accepted. You should calculate those values first and pass the result as a single parameter. See MySQL LIMIT[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900