clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
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. 2335470 fiddles created (27400 in the last week).

create table t (Semana int, Codigo int, Fecha date); insert into t values (01, 100, '20190101'), (02, 100, '20190108'), (01, 200, '20190101'), (02, 200, '20190108');
4 rows affected
 hidden batch(es)


with ct as ( select distinct Semana, Codigo, Fecha, row_number() over (partition by Codigo order by Fecha desc) rn from t ) select Semana, Codigo, Fecha from ct where rn = 1
Semana Codigo Fecha
2 100 2019-01-08
2 200 2019-01-08
 hidden batch(es)