declare @t table([date] datetime) insert into @t select '2005-11-02' union all select '2005-11-04' union all select '2005-11-05' union all select '2005-12-14' union all select '2005-12-16' union all select '2005-12-17'select count(1) from @t a where exists(select 1 from @t where [date]=dateadd(day,1,a.[date]))
insert into @t select '2005-11-02'
union all select '2005-11-04'
union all select '2005-11-05'
union all select '2005-12-14'
union all select '2005-12-16'
union all select '2005-12-17'select count(1) from @t a where exists(select 1 from @t where [date]=dateadd(day,1,a.[date]))