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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 IIF(access) to SQL

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-03-06 : 09:17:38
Ema writes "I know that in SQL, IIF(access) does not work. I need to use "Sum (CASE", but I have trouble using that in query, can you help?

select ... Sum(IIf([ItmMrp]="1" Or "3" Or "4" Or "8" Or "9",([Dmd2]+[Dmd3]),0)) AS ProjUsageStock FROM Itm_forecast_cur

Thanks.
Ema""

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-06 : 09:21:25
Use Case

Select sum(Case when ItmMrp in('1' ,'3','4','8','9') then [Dmd2]+[Dmd3] else 0 end) AS ProjUsageStock FROM Itm_forecast_cur

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-03-06 : 09:47:57
Ema -- didn't we already go over this? (or maybe the AskSQLTeam questions were queued up and just released today?)
Go to Top of Page
   

- Advertisement -