Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get the FY if not part of the current year
Message
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
How to get the FY if not part of the current year
Divers
Thread ID:
00678540
Message ID:
00678540
Vues:
52
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform