Feb 18, 2013

Posted by in Technology, Web Development | 0 comments

Query to find duplicate records in mysql

Finding duplicate rows/records in mysql is a query away, lets consider an example before writting the query.

We have a table called vendor_orders with column name vendor_id, order_id, user_id

Now we want to find duplicate orders in that table, if any.

So the query would be

SELECT order_id, COUNT( * ) c
FROM vendor_orders
GROUP BY order_id
HAVING c >1

Leave a Reply