clear markdown compare help donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
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. 541809 fiddles created (11236 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 min(id) keep(dense_rank first order by kind) id , val , min(kind) kind from mytable group by val;
ID VAL KIND
3 3 4
2 1337 1
 hidden batch(es)