I currently have a large SQL statement in which I add the following line to get the total amount for each transaction ID (which is unique):
select sum(cash) from Table a where a.branch = p.branch and a.transID = p.transID) TotalCash
and now I need to do the same thing, but only the total number of monetary values โโthat have been significant in the last month, so I have something like this:
select sum(CASE ValueDate WHEN > @startMonthDate THEN cash ELSE NULL END) from Table a where a.branch = p.branch and a.transID = p.transID) TotalMonthCash
Sorry I donโt have the whole statement, but it is really long and context specific to the stored procedure, but was hoping someone would find out what I mean?
sql
Grace Dec 23 '10 at 10:03 2010-12-23 10:03
source share