add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
with cte1 as
(
select '12/29/2018' as d,'loc78979' as val,1265 as fid
union
select null as d,'loc78979' as val,1266 as fid
union
select '12/29/2018' as d,'loc78979' as val,1263 as fid
union
select '12/29/2018' as d,'loc78979' as val,1237 as fid
)
select * from
(
select *,lag(d,1,0) over(order by d,fid,val) as prevval
from cte1
)x where isnull(d,1)<>isnull(prevval,0)
-- where d<>prevval
d val fid prevval
null loc78979 1266 0
12/29/2018 loc78979 1237 null