cdun2 (2/4/2008)
with the CASE nested in the SUM, I got this:Msg 130, Level 15, State 1, Line 5
Cannot perform an aggregate function on an expression containing an aggregate or a subquery.
sorry, i was trying to simplify sum(a)+sum(b)+sum(c) to sum(a+b+c). this should work.
sum( case when ds.TxDate >= DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
then isnull(ds.FuelFee,0) + isnull(ds.CashFee,0) + isnull(ds.ScFee,0)
else 0 end ) AS MTD,