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. 2591697 fiddles created (45712 in the last week).

create table test as select 20 as id, '2021-07-22' as date, 75 as sval union all select 21 as id, '2021-07-23' as date, 74 as sval union all select 22 as id, '2021-07-24' as date, 75 as sval union all select 23 as id, '2021-07-25' as date, 75 as sval union all select 24 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 26 as id, '2021-07-28' as date, 74 as sval union all select 27 as id, '2021-07-29' as date, 74 as sval union all select 28 as id, '2021-07-30' as date, 74 as sval union all select 29 as id, '2021-07-31' as date, 74 as sval
 hidden batch(es)


select t.sval into @lastValue from test t order by t.date desc limit 1;
 hidden batch(es)


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