clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
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. 582762 fiddles created (13361 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)