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

create table mytable(id integer, val integer, kind integer);
 hidden batch(es)


insert into mytable(id,val,kind) values(1,1337,2);
1 rows affected
 hidden batch(es)


insert into mytable(id,val,kind) values(2,1337,1);
1 rows affected
 hidden batch(es)


insert into mytable(id,val,kind) values(3,3,4);
1 rows affected
 hidden batch(es)


insert into mytable(id,val,kind) values(4,3,4);
1 rows affected
 hidden batch(es)


select * from mytable where id in ( select min(id) keep (dense_rank first order by kind, id) from mytable group by val );
ID VAL KIND
2 1337 1
3 3 4
 hidden batch(es)