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.
Author |
Topic |
Durbslaw
Starting Member
43 Posts |
Posted - 2009-06-26 : 02:59:05
|
Hi,I need to find a total [amount] for a period between july and june (financial year), the table has several years of financial information so the regular, sum(amount) between datestart and dateend will not work...YTDTotal=(case when datepart(mm, [date])>=7 then datename(dateadd(yyyy,1,[date]))AND sum(amount)elsedatename(dateadd(yyyy,-1,[date])AND sum(amount)end)Thanks |
|
|
|
|