Flag records 7 days from the previously identify record

  Kiến thức lập trình

I’m looking to flag those records that are >= 7 days from the previously identify record.
From the example below, the valid records are 4-10-2022, 4-20-2022 and 4-28-2022

drop table #tmp1
create table #tmp1(
membernum int,
sevrfromdate date
)

insert into #tmp1
values (1000016, ‘4/10/2022’)
insert into #tmp1
values (1000016, ‘4/20/2022’)
insert into #tmp1
values (1000016, ‘4/21/2022’)
insert into #tmp1
values (1000016, ‘4/25/2022’)
insert into #tmp1
values (1000016, ‘4/26/2022’)
insert into #tmp1
values (1000016, ‘4/28/2022’)

desired output

New contributor

batoni is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

3

Theme wordpress giá rẻ Theme wordpress giá rẻ Thiết kế website

LEAVE A COMMENT