title: MYSQL remove duplicates where multiple columns match
body: <p>I have a table > 500,000 rows where there are duplicate entries that need to be removed but only where a few columns match.</p>
  
  <p>The main table has the following columns</p>
  
  <pre><code>id,
  countryID,
  postalCode,
  adminName1,
  adminName2,
  placeName,
  adminName3,
  latitude,
  longitude
  </code></pre>
  
  <p>I need to remove duplicates (leaving the first record) where 
  placeName, latitude &amp; longitude match</p>
  
  <p>I had a search and found this which looks right but doesnt work for me.
  I have duplicated the original table structure into a new table (tblTemp)</p>
  
  <pre><code>INSERT INTO tblTemp(id,countryID,postalCode,adminName1,adminName2,placeName,adminName3,latitude,longitude)
  SELECT DISTINCT placeName,latitude,longitude
  FROM tblCountry_admin;
  </code></pre>
  
  <p>But i get the error</p>
  
  <blockquote>
    <p>Column count doesn't match value count at row 1</p>
  </blockquote>