i have a table called timesheet.In that i has below rows
ID Status ProjId ActId Date
1 pending 1 1 2014-aug-07
2 denied 1 2 2014-aug-08
3 saved 1 3 2014-aug-09
4 approved 1 4 2014-aug-10
i have used below query for getting the desired result.
SELECT * from tblTimesheet
WHERE DATEPART(wk,spentDate) = 32 AND ((timesheetstatus = 'Pending' or timesheetstatus = 'Approved') and (timesheetstatus <> 'Saved' or timesheetstatus <> 'Denied'))
My expected result for the above query is 0.But i get the result is 1.
5 pending 1 1 2014-aug-11
6 pending 1 2 2014-aug-12
7 approved 1 3 2014-aug-13
8 approved 1 4 2014-aug-14
this case my query works.
SELECT * from tblTimesheet
WHERE DATEPART(wk,spentDate) = 32 AND ((timesheetstatus = 'Pending' or timesheetstatus = 'Approved') and (timesheetstatus <> 'Saved' or timesheetstatus <> 'Denied'))
My expected result for the above query is 1.I get the result is 1.
How to write the query for above requirement in mssql. Scenario 1 is worked.But scenario2 is not worked. How to acheive the desired result. Any help will be greatly appreciated!!!