使用带有BETWEEN的括号时出现语法错误

时间:2013-05-06 00:49:37

标签: mysql select between

我认为以下是我搜索10分钟时间内所有来电的方式

SELECT * FROM `call_log` WHERE start_time BETWEEN ('2012-05-01 17:50:00' AND '2013-05-01 18:00:00')

但是,当我运行此查询时,我收到以下错误

#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 'LIMIT 0, 30' at line 2

我不确定这是什么意思。日期格式也与上面相同。y-m-d h:m:s

2 个答案:

答案 0 :(得分:1)

您不需要括号:

SELECT * FROM `call_log` 
WHERE 
start_time BETWEEN '2012-05-01 17:50:00' AND '2013-05-01 18:00:00'

答案 1 :(得分:0)

以下是围绕这些类型的查询和函数的MySQL链接。正如有人注意到的(并打败了我),你不需要括号......

http://dev.mysql.com/doc/refman/4.1/en/date-and-time-functions.html