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.

 All Forums
 Other Forums
 MS Access
 'Case When Then Else End' works in Access 97 ?

Author  Topic 

matkwan
Starting Member

36 Posts

Posted - 2002-07-24 : 10:01:36
Hi, Can Access 97 handle 'Case When Then Else End' in the SQL ? I have tried it and it didn't allow me to run the SQL. Just wanna confirm with you, and also is there a way around it to perform the same function.

select sum(case status when 'U' then 1 else 0 end) as 'Undetermined',
sum(case status when 'W' then 1 else 0 end) as 'Won',
sum(case status when 'L' then 1 else 0 end) as 'Lost',
datename(m,date) as 'Month'
from tbl_Contracts
group by datename(m,date)

Thanks

LarsG
Constraint Violating Yak Guru

284 Posts

Posted - 2002-07-24 : 14:25:28
No. Use iif, e.g.

iif(status='U',1,0)

Go to Top of Page

matkwan
Starting Member

36 Posts

Posted - 2002-07-24 : 21:00:49
Thank You. 'IIF' works great :)

Matt

Go to Top of Page
   

- Advertisement -