create table #t (id int, Edate datetime)
insert into #t (id ,Edate)
select 1,getdate()-30 union all
select 2,getdate()+30 union all
select 3,getdate()+5 union all
select 4,getdate()+26 union all
select 5,getdate()
select * from #t
select *,datediff(day,getdate(),Edate)as Date...