Manish wrote:

I have got few duplicate record in my DB as follows.-

Let's say record_no is the unique id of duplicate records.
So I have fields ID, record_no , X and Y. (ID is a dif filed and is a
primary key)

To find duplicates I do following -

select record_no,count(record_no) from mytable group by record_no having
count > 1;

Now I want to delete all these duplicate records in such a way that only one
of them for each record_no stays in the database (the one with highest ID
may stay).
How can I do this??

TIA,
- Manish



delete from mytable where record_no=? limit ?

Setting the first parameter to the record number and the second to count - 1.



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to