By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table yourtablename ([date] date,a int,b int,c int);
insert into yourtablename values
('04/26/2008',1,1,1)
,('04/25/2008',1,2,1)
,('04/24/2008',1,1,1)
,('04/23/2008',1,1,1)
,('04/22/2008',1,1,1)
,('04/21/2008',2,2,2)
,('04/20/2008',1,1,1);
; with cte as
(select *,
row_number() over (partition by a,b,c order by date asc) as rn
, row_number() over (order by date asc) as rn1
from yourtablename
)
select min(date) date,a,b,c from cte group by (rn1-rn),a,b,c
order by min(date) desc
date | a | b | c |
---|---|---|---|
2008-04-26 | 1 | 1 | 1 |
2008-04-25 | 1 | 2 | 1 |
2008-04-22 | 1 | 1 | 1 |
2008-04-21 | 2 | 2 | 2 |
2008-04-20 | 1 | 1 | 1 |