Have you concluded that fixing this using SQL would affect perofrmance? (like using group by).
Otherwise using SQL similar to following can get you the desired result:
select * from YOURTABLE t where t.level = (select min(level) from YOURTABLE group by name having name=t.name)