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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 help needed with the select query...

Author  Topic 

raaj
Posting Yak Master

129 Posts

Posted - 2009-03-18 : 00:22:01
Hi Guys,
Our company's financial year period is between July 1st and June 30th of the year. so we treat July as 200901, August as 200902, September as 200903 and so on......
I would like to know the query to find out the min period and max period of the current financial year.
I am having a table "Periods" which has following sample values :

200909 2009-03-01 2009-03-31 237 9 2009 200903 2009 3 March
200908 2009-02-01 2009-02-28 236 8 2009 200902 2009 2 February
200907 2009-01-01 2009-01-31 235 7 2009 200901 2009 1 January
200906 2008-12-01 2008-12-31 234 6 2009 200812 2008 12 December
200905 2008-11-01 2008-11-30 233 5 2009 200811 2008 11 November
200904 2008-10-01 2008-10-31 232 4 2009 200810 2008 10 October
200903 2008-09-01 2008-09-30 231 3 2009 200809 2008 9 September
200902 2008-08-01 2008-08-31 230 2 2009 200808 2008 8 August
200901 2008-07-01 2008-07-31 229 1 2009 200807 2008 7 July
200812 2008-06-01 2008-06-30 228 12 2008 200806 2008 6 June
200811 2008-05-01 2008-05-31 227 11 2008 200805 2008 5 May
200810 2008-04-01 2008-04-30 226 10 2008 200804 2008 4 April
200809 2008-03-01 2008-03-31 225 9 2008 200803 2008 3 March
200808 2008-02-01 2008-02-29 224 8 2008 200802 2008 2 February
200807 2008-01-01 2008-01-31 223 7 2008 200801 2008 1 January

raaj
Posting Yak Master

129 Posts

Posted - 2009-03-18 : 00:26:13
I am sorry guys,
I forgot to give the filed names :
Here are the field names:

Period, Start_Date, End_date, PeriodKey, PeriodNum, FinYear, CalPeriod, CalYear, CalMonth, Month

I know how to find the max period, but I am not able to find How to the min Period for the current financial year.

Tahnks,
raaj....
Go to Top of Page
   

- Advertisement -