Find and delete latter duplicate records
<p>I have a table that has 0.5 to 1 million records approx. The table has duplicate records by a varchar field.</p>

<p>Something like</p>

<pre><code>ID int(11)
TITLE varchar(100)
</code></pre>

<p>There are many records that have duplicate TITLE values.</p>

<p>I need to remove the duplicate records. The first step is to find them. I suppose there are two methods:</p>

<ol>
<li><p>To use <code>GROUP BY TITLE HAVING COUNT(*) &gt; 1</code></p></li>
<li><p>Go record by record using <code>SELECT ID, TITLE FROM MY_TABLE</code> and then for each record use a <code>SELECT ID FROM MY_TABLE WHERE TITLE='".$row['TITLE']." AND ID &lt;&gt; '".$row['ID']."'</code></p></li>
</ol>

<p>The question is that which method is efficient?</p>

<p>Or is there another more efficient method?</p>

<p>I am using php as the base language.</p>