我收到此错误:
1064 - 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 '=> "2018-08-14" AND createDate =< "2018-08-28" ORDER BY createDate DESC LIMIT 0,' at line 1
当我运行此查询时:
SELECT * FROM offer_request WHERE createDate => "2018-08-14" AND createDate =< "2018-08-28" ORDER BY createDate DESC LIMIT 0, 15
createDate 是日期时间字段。即:2018-07-19 12:53:59
最佳答案
您的 sql 查询有错误,必须像这样使用并尝试对日期时间字段使用 date() 函数
SELECT * FROM offer_request WHERE date(createDate) >= '2018-08-14' AND date(createDate) =< '2018-08-28' ORDER BY createDate DESC LIMIT 0, 15
关于php - 对日期时间字段运行选择查询时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51836112/