|
Posted by Stefan Rybacki on 11/29/05 13:29
Brian wrote:
> Hi there
>
> I'm trying to work out how to run a query
> that checks if there are duplicated records
> in a table and then have to run a query to
> delete them (need to check if there are
> an duplicates before I delete them)
>
> the 3 fields to use as the test would be
> product, description, dnote
>
> any help / advice?
Just do a grouping over those three attributes and count the group members.
SELECT * FROM table GROUP BY product, description, dnote HAVING count(*)>1
For deletion you could use this as subquery (mysql >4.1) or a temporary table with which
you join in the delete statement.
Regards
Stefan
>
> Brian
>
>
>
Navigation:
[Reply to this message]
|