SQL Server 2000 имеет свои ограничения.Переписал решение, чтобы сделать его более читабельным.
declare @t table
(
[Date] datetime,
Code char(1)
)
insert into @T values
('1/1/2011','A'),
('1/2/2011','A'),
('1/3/2011','A'),
('1/1/2011','B'),
('1/2/2011','B'),
('3/1/2011','A'),
('3/2/2011','A'),
('3/3/2011','A'),
('3/4/2011','A')
select a.code, a.date, min(b.date)
from
(
select *
from @t t
where not exists (select 1 from @t where t.code = code and t.date -1 = date)
) a
join
(
select *
from @t t
where not exists (select 1 from @t where t.code = code and t.date = date -1)
) b
on a.code = b.code and a.date <= b.date
group by a.code, a.date