mysql语句没有返回正确的结果

时间:2013-05-19 17:05:14

标签: mysql

我有一个mysql行,其中'date = 2013-05-02,type = 1'等。

然后我运行此查询

SELECT date, type, status, rate 
FROM reservation 
WHERE  type = 1 
AND date BETWEEN 2013-05-01 AND 2013-05-08  
ORDER BY date asc 
LIMIT 0, 10

但这会返回空结果。这里的查询问题是什么?

2 个答案:

答案 0 :(得分:2)

将日期放在引号'中的mysql查询中。

SELECT date, type, status, rate 
FROM reservation 
WHERE  type = 1 
AND date BETWEEN '2013-05-01' AND '2013-05-08'
ORDER BY date ASC
LIMIT 0, 10 ;

答案 1 :(得分:0)

尝试BETWEEN'2013-05-01'和'2013-05-08'