How can I group in blocks of 5 years?
Like 1998-2002, 1993-1997, ...
Of course the group will change for next year e.g. 1999-2003, and so on.
CR8 SQL2000
select convert(integer,((year(getdate())-year(MyTable.MyDate))/5.0)) as FiveYearGroup,
count(*) as GroupCount
from MyTable
group by convert(integer,((year(getdate())-year(MyTable.MyDate))/5.0))
order by FiveYearGroup
I created a formula @FiveYearGroup
fix(((year(today)) - year({MyTable.MyDate})) / 5)
in Crystal, and grouped on it.
I also created the formula below that covers up to 98 years:
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.