How to remove duplicate rows except one?

Viewed 8806

On mytable no column is primary :

Name Company Position
Michael Google Tester
Michael Google Tester
Michael Google Tester
Peter Facebook Developer
Peter Facebook Developer
Peter Facebook Developer
Peter Facebook Developer

What I want :

Name Company Position
Michael Google Tester
Peter Facebook Developer

This does not work :

DELETE FROM
   mytable
WHERE
   Name NOT IN (
      SELECT
         MAX(Name)
      FROM
         mytable
      GROUP BY
         Company
   )
;

Without new table creation and no CTE, how can I remove duplicate rows except one?

3 Answers
Related