DELETE `yellow_page_content`
from `yellow_page_content`
inner join (
select max(`id`) as lastId, `code`
from `yellow_page_content`
group by `code`
having count(*) > 1) duplic on duplic.code = yellow_page_content.code
where yellow_page_content.id < duplic.lastId;