CASE WHEN WHERE CLAUSE
Hi everybody, I need some help. I'm trying to get a solution from the following code: The WHERE clause is where I'm having problems. I'm trying to combine two statements in the where clause if I run them seprate I get the answer I'm looking for but I want to combine the two to get one answer. I think I need a CASE WHEN in the WHERE Clause. Can anyone help me??
SELECT SUM(mPremium) as 'Total Gross Prem', SUM(mPremium)+
SUM((Case When mPremium < 0 Then mPremium Else 0 End)) as 'Total Net Prem',
SUM((Case When mPremium < 0 Then mPremium Else 0 End))as 'Total Return Prem',
(SUM(mPremium)+ SUM((Case When mPremium < 0 Then mPremium Else 0 End)))* .06 as 'Total Tax Due'
Where (dtSubmitDate >= '1/1/2005' and dtSubmitDate <= '12/31/2005'and dtPolicyIncepDate < '1/1/2005'and
vchTransactionType <> 'NEW POLICY' and vchTransactionType <> 'Renewal')
and vchSLBLicNo = 'A172757'
Case When (dtPolicyIncepDate >='1/1/2005' and
dtPolicyIncepDate <= '12/31/2005' and vchSLBLicNO = 'A172757') end