delete from titles_test where id not in (select * from (select min(id) from titles_test group by emp_no)as min_id) # select T.* # from # (select # *, # rank()over(partition by emp_no order by id) as rp # from titles_test) as T # where T.rp = 1
select T.* from (select *, rank()over(partition by emp_no order by id) as rp from titles_test) as T where T.rp = 1