Determine year from month count (1 Viewer)

WineSnob

Not Bright but TENACIOUS
Local time
Today, 16:06
Joined
Aug 9, 2010
Messages
211
I have a table that has a field for month represented by a number. I would like to report by month but group by year.
The report would group months 1-12 into year 1, months 13-24 into year 2, months 25-36 into year3, etc..... up to possible 20 years. Is there an easy way to identify and group the year?
I was thinking of adding another column to the table and when I write the values to it include a year. I would rather do it some other way as the data is spilt and would require a lot of table modifications to distributed db. It would be easier to do it with a query or some code in the front end.
:banghead:
 

TJPoorman

Registered User.
Local time
Today, 14:06
Joined
Jul 23, 2013
Messages
402
Here is how you could do it in a query:

Code:
SELECT (MonthNumber-(FIX((MonthNumber-.5)/12)*12)) AS Month, (FIX((MonthNumber-.5)/12)+1) AS Year FROM MyTable

I'm sure there is a more elegant way, but this is what I threw together really quick.
 

WineSnob

Not Bright but TENACIOUS
Local time
Today, 16:06
Joined
Aug 9, 2010
Messages
211
PERFECT... Worked like a charm. Thanks
 

Users who are viewing this thread

Top Bottom