Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Jay87
Starting Member
41 Posts |
Posted - 2010-03-09 : 06:59:23
|
I have the following query that counts the no of closed calls this month:SELECT Count(id) as closedcurrentmonth from faultlog where closed>DATENAME(YEAR,GETDATE()) + '-' + cast(DATEPART(MONTH,GETDATE()) as nvarchar(12)) + '-01' AND status=15 the status=15 means the status is closed but the problem we have with this is that once a call has been closed we do a customer satisfied follow up call which changes the status to 20 which buggers up the stats!I want to replace the status=15 with closed="" i.e. have a date/time field in it (the date it was closed) but i can't get it to work, i also tried closed <> Null which also didn't work....I presume i am getting the syntax wrong? Can anyone help please? |
|
|
Jay87
Starting Member
41 Posts |
Posted - 2010-03-09 : 08:28:06
|
| can anyone help with this? |
 |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-03-09 : 08:33:58
|
| Not getting your requirementVabhav T |
 |
|
|
Jay87
Starting Member
41 Posts |
Posted - 2010-03-09 : 08:46:37
|
I want to edit this code:SELECT Count(id) as closedcurrentmonth from faultlog where closed>DATENAME(YEAR,GETDATE()) + '-' + cast(DATEPART(MONTH,GETDATE()) as nvarchar(12)) + '-01' AND status=15 to add something like AND closed="" or AND closed <> Null (neither of these work)...I want the code to select all the items that have something in the 'closed'(date/time field) column.... basically ignore the Null's! |
 |
|
|
haroon2k9
Constraint Violating Yak Guru
328 Posts |
Posted - 2010-03-09 : 08:51:23
|
quote: Originally posted by Jay87 I want to edit this code:SELECT Count(id) as closedcurrentmonth from faultlog where closed>DATENAME(YEAR,GETDATE()) + '-' + cast(DATEPART(MONTH,GETDATE()) as nvarchar(12)) + '-01' AND status=15 to add something like AND closed="" or AND closed <> Null (neither of these work)...I want the code to select all the items that have something in the 'closed'(date/time field) column.... basically ignore the Null's!
just try thisand closed is not null |
 |
|
|
|
|
|