SQL LIMIT语法错误 [英] SQL LIMIT syntax error
本文介绍了SQL LIMIT语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这就是全部:
SELECT * FROM sometable LIMIT 5*DATEDIFF(NOW(), '2011-08-30'), 5
错误:
您的SQL语法有错误;检查手册 对应于您的MySQL服务器版本以使用正确的语法 第1行的'* DATEDIFF(NOW(),'2011-08-30'),5'附近
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 '*DATEDIFF(NOW(), '2011-08-30'), 5' at line 1
问题显然是LIMIT
显然不接受任何东西,但接受整数.它也不会接受1+1
或(1+1)
作为值.有办法解决吗?
The problem is clearly that LIMIT
does not accept anything but integer apparently. It won't accept 1+1
or (1+1)
as value either. Is there a way around it?
这样您就不必去尝试了,5*DATEDIFF(NOW(), '2011-08-30')
正常就可以了.
And just so you don't have to go and try, 5*DATEDIFF(NOW(), '2011-08-30')
works just fine.
查看全文