select * from table1 a
where id in(select min(id) from table1 group by name)
order by id