Try this, see if it'll do what you need:
create table #T (
ID int identity primary key,
Col1 char(10));
insert into #T (Col1)
select 'AC/01/2008' union all
select 'AC/02/2008' union all
select 'AC/03/2008' union all
select 'AC/04/2008' union all
select 'AC/05/2008' union all
select 'AC/06/2008' union all
select 'AC/07/2008' union all
select 'AC/08/2008' union all
select 'BC/01/2008';
select substring(Col1, 1, 2), max(substring(Col1, 4, 2)), substring(Col1, 7, 4)
from #T
group by substring(Col1, 1, 2), substring(Col1, 7, 4);
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon