我正在使用mariasql
nodejs 中的模块来连接 mariadb。我的查询是:
select * from products where id=1 order by timestamp DESC LIMIT 0,10
当我将固定值传递给限制时,此查询工作正常。
现在我尝试从参数中获取值。
select * from products where id=:pid order by timestamp DESC LIMIT :start,:end
此查询引发以下错误。
{ Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''0','10'' at line 1 code: 1064 }
where 因为它从 where 子句的参数中接受值。