clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2591614 fiddles created (45712 in the last week).

create table test as select 25 as id, '2021-07-22' as date, 75 as sval union all select 25 as id, '2021-07-23' as date, 74 as sval union all select 22 as id, '2021-07-23' as date, 74 as sval union all select 22 as id, '2021-07-24' as date, 71 as sval union all select 22 as id, '2021-07-25' as date, 71 as sval union all select 25 as id, '2021-07-24' as date, 75 as sval union all select 25 as id, '2021-07-25' as date, 75 as sval union all select 25 as id, '2021-07-26' as date, 75 as sval union all select 25 as id, '2021-07-27' as date, 74 as sval union all select 25 as id, '2021-07-28' as date, 74 as sval union all select 25 as id, '2021-07-29' as date, 74 as sval union all select 25 as id, '2021-07-30' as date, 74 as sval union all select 25 as id, '2021-07-31' as date, 74 as sval
 hidden batch(es)


with LastValue as ( select t.sval from test t order by t.date desc limit 1 ) select t.* from test t where t.sval = (select sval from LastValue) and t.date > (select max(tt.date) from test tt where tt.sval <> (select sval from LastValue)) order by t.date asc limit 1;
id date sval
25 2021-07-27 74
 hidden batch(es)