jylland Starting Member
22 Posts
sunitabeck Flowing Fount of Yak Knowledge
5152 Posts
SELECT CASE WHEN Totalos > 0 THEN 0 ELSE (totalos-100) END AS Price FROM dbo.database
sodeep Flowing Fount of Yak Knowledge
USA 7173 Posts
quote:Originally posted by jyllandhi I have problem SELECT SUM(value) AS Totalos from tabel where .... then I want validation of the TotalIf Totalos > 0 then 0else (totalos-100) end AS Price FROM dbo.database where......But how do I do this with a case statement ?
Case When SUM(Values) > 0 then 0 Else SUM(Values)- 100 End
quote:Originally posted by sunitabeckSELECT CASE WHEN Totalos > 0 THEN 0 ELSE (totalos-100) END AS Price FROM dbo.databaseBTW, "database" is not really a good name for a table. If you do choose to use it, use it like dbo.[database]
quote:Originally posted by sodeepquote:Originally posted by jyllandhi I have problem SELECT SUM(value) AS Totalos from tabel where .... then I want validation of the TotalIf Totalos > 0 then 0else (totalos-100) end AS Price FROM dbo.database where......But how do I do this with a case statement ?Case When SUM(Values) > 0 then 0 Else SUM(Values)- 100 EndThanks very much great