( fhuse | 2022. 05. 18., sze – 16:48 )

delete from table
where exist ( 
   select 1 
   from table t 
   join (select group, value, min(len(prefix)) lprfx 
              from table 
              group by group, value )  p
        on t.group = p.group
       and t.value = p.value
       and len(t.prefix)> p. lprfx 
)

ha tobb azonos min. hosszu prefix van meghagyja mindet. (nem tesztteltem, fejbol irtam)