2014-11-25 109 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