![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
You must use IS NULL to compare something with NULL: SELECT case when [Order] IS NULL then 13 else [Order] end, [Product Roll-Up],... -- Tom ---------------------------------------------------- Thomas A. Moreau, BSc, PhD, MCSE, MCDBA SQL Server MVP Toronto, ON Canada . "Conan Kelly" <CTBarbarin at msn dot com> wrote in message news:e1qHJaxYGHA.2136 (AT) TK2MSFTNGP05 (DOT) phx.gbl... Hello all, I'm sorry if this is not an appropriate NG to post this question to. I looked for one and nothing jumped out at me. I have a SQL statement goes something like this: SELECT [Order], [Product Roll-Up], sum(case [File Date] when '12/31/02' then [Balance] end) as '12/31/02', sum(case [File Date] when '1/31/03' then [Balance] end) as '1/31/03', ... ... ... ... as '3/31/06' FROM View1 GROUP BY [Order], [Product Roll-Up] ORDER BY [Order], [Product Roll-Up] The results in the [Order] field will be NULL in the first row and 1 through 12 in the following rows. What I want to do is set this up so that it will return 13 instead of NULL. I tried the following select statement but it didn't work: SELECT case [Order] when NULL then 13 else [Order] end, [Product Roll-Up],... Is there any way to accomplish what I'm trying to do by editing the SQL statement similar to how I did above? Thanks for any help anyone can provide, Conan Kelly ps. please let me know of a better NG to post questions like this to. |
![]() |
| Thread Tools | |
| Display Modes | |
| |