我有一個存儲過程檢查在我的數據庫中預定的假期,它不應該考慮狀態爲「已拒絕」或「已取消」的假期,但是在我的數據庫中只有一條記錄具有狀態的下降,但這個選擇語句返回1?存儲過程返回錯誤的值?
SELECT COUNT(*) JobRoleID
FROM Employees
RIGHT JOIN Holidays
ON Employees.ID = Holidays.EmployeeID
WHERE Holidays.Status <> 'Declined' AND Holidays.Status <> 'Cancelled'
AND (Holidays.Startdate <= '2014/04/28' AND Holidays.Enddate >= '2014/04/30')
OR (Holidays.Startdate >= '2014/04/28' AND Holidays.Enddate <= '2014/04/30')
OR (Holidays.Startdate <= '2014/04/30' AND Holidays.Enddate >= '2014/04/30')
OR (Holidays.Startdate <= '2014/04/28' AND Holidays.Enddate >= '2014/04/28')
OR (Holidays.StartDate = '2014/04/28' AND Holidays.EndDate = '2014/04/30')
返回此行的假期的狀態是什麼? –
已拒絕。 @我知道。 – Elwin