2014-11-25 92 views
-1

的行数这是我的查询,我使用:获取取决于日期

SELECT COUNT(*), categoryName 
FROM StuSelectCateg 
WHERE depName = 'Admisiones' timeOut>= '$Date1' 
     AND timeOut < '$Date2' 
GROUP BY categoryName 

,但它不返回任何结果。

This is my Database

This is the output i want but with the dates

+1

您在depName和timeOut之间的WHERE子句中缺少'AND'。你需要打开错误报告,所以它会告诉你,而不是给你一个空白的结果。是否解决了关于输出的问题很难说,因为缺少任何其他信息在你的问题 – Sir 2014-11-25 04:03:45

回答

1

改变这一行

where depName = 'Admisiones' timeOut>= '$Date1' and timeOut < '$Date2' 

where depName = 'Admisiones' and timeOut>= '$Date1' and timeOut < '$Date2' 

你缺少and之前timeOut

-1

您的查询不正确并丢失AND。请尝试以下查询

Select count(*), categoryName 
from StuSelectCateg 
where depName = 'Admisiones' and timeOut>= '$Date1' 
     and timeOut < '$Date2' 
group by categoryName 
+0

哇多么愚蠢!反正我很感谢 – 2014-11-25 05:13:08