select giftid,
sum(case when gifteffdat >'7/1/2009' then giftamount else 0)end as FY11
from gifttable
where [FY11] = 0
group by giftid
I tried using FY11 = 0 and get an error message. I am trying to use the FY11 to eliminate records based on the date range. Can I do this or must I repeat the sum(case formula at the bottom after the group by
I am using SQL 2005
sum(case when gifteffdat >'7/1/2009' then giftamount else 0)end as FY11
from gifttable
where [FY11] = 0
group by giftid
I tried using FY11 = 0 and get an error message. I am trying to use the FY11 to eliminate records based on the date range. Can I do this or must I repeat the sum(case formula at the bottom after the group by
I am using SQL 2005