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 |
omega1983
Starting Member
40 Posts |
Posted - 2009-05-26 : 15:59:47
|
Platform: MS SQL Server 2005I am trying to construct an sql view based on a fiscal year starting with 7(July) and ending with 6(June). I will eventually use totals for a 4 year fiscal year. If the giftdate falls within the date range, I want to list the totals in the correct fiscal year. I want a total for pastdue,fy2008,2009,2010 and 2011ieSelect sum(giftamount) as paymentsDue,giftkeyThe output should look like thispastdue $0.00 or amountfy2008 $0.00 or amountfy2009 $0.00 or amountfy2010 $0.00 or amountfy2011 $0.00 or amountI am thinking I need a parameter based on a date range and several case statementsAny ideas? |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-05-26 : 18:14:53
|
Select sum(giftamount) as paymentsDue, datepart(year, dateadd(month, 6, giftdate)) AS fyfrom table1group by datepart(year, dateadd(month, 6, giftdate)) E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|