Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql 如何使用sql select语句获取两个日期范围内的特定列_Mysql_Sql - Fatal编程技术网

Mysql 如何使用sql select语句获取两个日期范围内的特定列

Mysql 如何使用sql select语句获取两个日期范围内的特定列,mysql,sql,Mysql,Sql,我想检索特定日期范围内的列值我得到了一个列名为Plate_u和PR_udate的表我希望sql语句得到特定日期范围内的Plate_u列表我尝试了这个方法,但我不工作 select * from PR_Schedule where Plate_#='3-08294' and PR_Date between '2014-06-09 00:00:00.000' and '2014-06-15 00:00:00.000' 我会使用而不是between select * from PR_Schedule

我想检索特定日期范围内的列值我得到了一个列名为Plate_u和PR_udate的表我希望sql语句得到特定日期范围内的Plate_u列表我尝试了这个方法,但我不工作

select * from PR_Schedule where Plate_#='3-08294' and PR_Date between '2014-06-09 00:00:00.000' and '2014-06-15 00:00:00.000'

我会使用而不是between

select * from PR_Schedule where Plate_#='3-08294' and PR_Date > '2014-06-09 00:00:00.000' and PR_Date < '2014-06-15 00:00:00.000'

如果日期范围为代码作为参数:

@FromDate datetime,
@ToDate datetime

AS

select * from PR_Schedule
where
Plate_#='3-08294'
AND
PR_Date between @FromDate and @ToDate
如果问题是静态日期:

select * from PR_Schedule
where
Plate_#='3-08294'
AND
PR_Date between '06/09/2014'and '06/15/2014'

您的查询看起来不错,问题出在哪里?请在select查询中使用相应的列,而不是*