Free for PREMIUM members
create table #tmp1 (key int, eff_dt date, term_dt date)
-- you could add indexes on the two tmp tables if you have large enough data sets
select a.key, a.eff_dt, b.term_dt into #tmp1 from TableA a, TableA b
where a.key = b.key and dateadd(day,a.term_dt,1) = b.eff_dt
select * into #tmp1 from TableA a
where not exists (select 1 from TableA b where a.key = b.key and dateadd(day,a.term_dt,1) = b.eff_dt)
and not exists (select 1 from #tmp1 t where a.key = t.key and a.term_dt = t.term_dt)
Open in new window
Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.