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

create table mytable(id int, parent_id int); insert into mytable values (1,null), (2,1), (3,1), (4,2), (5,2), (6,3), (7,4), (8,5), (9,6), (10,3);
10 rows affected
 hidden batch(es)


select * from mytable where id not in(select parent_id from mytable group by parent_id having count(*) > 1);
id parent_id
4 2
5 2
6 3
7 4
8 5
9 6
10 3
 hidden batch(es)