SQL查询不能与日期之间的日期工作

时间:2014-03-20 10:04:15

标签: mysql sql phpmyadmin

Mysql查询似乎没有工作,任何想法为什么?

SELECT 
    PH, 
    Chlorine, 
    Temperature, 
    Date, 
    Time 
FROM googlechart
 Where Date BETWEEN '2014-03-19' AND '2014-03-21' order by Date, Time;

2 个答案:

答案 0 :(得分:2)

试试这个:

SELECT 
    PH, 
    Chlorine, 
    Temperature, 
    Date, 
    Time 
FROM googlechart
WHERE Date BETWEEN '2014-03-19' AND '2014-03-21'
ORDER BY Date, Time;

你错过了WHERE。

答案 1 :(得分:0)

试试这个

 SELECT 
    PH, 
    Chlorine, 
    Temperature, 
    Date, 
    Time 
FROM googlechart
Where Date BETWEEN cast('2014-03-19' as datetime) 
AND cast('2014-03-21' as datetime) order by Date, Time;