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
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00678540
Message ID:
00678545
Vues:
16
This message has been marked as the solution to the initial question of the thread.
I guess, you'll have to use Begin and End date instead of year.
SET @BeginYear = CAST( 
				CAST(@tiYear AS char(4)) + '/' +
				CAST(@tiFiscalMonth AS char(2)) + '/01' 
                            AS datetime)
SET @EndYear = Dateadd(ss, -1, dateadd( mm, 13, @BeginYear))
...
	   where begintime  BETWEEN @BeginYear AND @EndYear
>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
>
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform