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 |
|
eugz
Posting Yak Master
210 Posts |
Posted - 2005-10-12 : 09:42:04
|
Hi All.I have problem to fix a view. It looks like:SELECT Date_P, -SUM(is not null [Result]) AS Complete, -SUM(is null [Result]) AS [Not Complete]FROM dbo.ProbGROUP BY Date_P Message says: "Incorrect syntax near the keyword 'is'." What is correct decision?Thanks. |
|
|
Page47
Master Smack Fu Yak Hacker
2878 Posts |
Posted - 2005-10-12 : 09:45:13
|
| how do you sum null values? do you mean count?select date_p, sum(case when result is null then 0 else 1 end) as complete, sum(case when result is null then 1 else 0 end) as notcompletefrom probgroup by date_pJay White |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-12 : 09:45:17
|
| Try thisSELECT Date_P, -SUM(Case When [Result] is not null then [Result] end) AS Complete, -SUM(Case When [Result] is null [Result] end) AS [Not Complete]FROM dbo.ProbGROUP BY Date_PMadhivananFailing to plan is Planning to fail |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-12 : 09:46:22
|
Just 4 seconds MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|