Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get the FY if not part of the current year
Message
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
How to get the FY if not part of the current year
Miscellaneous
Thread ID:
00678540
Message ID:
00678540
Views:
51
I have a customer who's fiscal year begin on June 1st anybody have some idea's on how to modify the query below to handle that?

Thanks in advance
set @tiYear = 2002
set @tiFiscalMonth = 6

SELECT co1.specdesc,AdmitDesc,
	(select COUNT(dbo.meetings.meetingnumber)
	   from dbo.meetings
	   where datepart(yy,begintime)= @tiYear
	   and meetings.specID = co1.specID
           and meetings.AdmitTypeID = m1.AdmitTypeID
	   and iscancelled = 0) as YTD
FROM   dbo.ctAdmissionType ad INNER JOIN
       dbo.meetings m1 ON ad.AdmitTypeID = m1.AdmitTypeID INNER JOIN
       dbo.cospec co1 ON m1.specid = co1.specid
where  m1.iscancelled=0
group by ad.AdmitDesc,m1.admitTypeID,co1.specdesc,co1.specID
order by 1
Next
Reply
Map
View

Click here to load this message in the networking platform