sql - Find duplicate records in MySQL for each customer ID -
sql - Find duplicate records in MySQL for each customer ID -
i seek find duplicate records each customer.
table: customers_points
points_id + customers_id + points_comment 1 200 order: 5227 2 200 order: 5227 3 200 order: 5227 4 201 order: 7000 5 201 order: 7000 6 202 order: 6000 7 203 order: 8000
the result should this:
customers_id + duplicate_rows 200 3 201 2
below current sql query(not accurate):
select c.* `customers_points` c inner bring together (select points_comment `customers_points` grouping points_comment having count(customers_id) > 1) dup on c.points_comment = dup.points_comment c.points_date_added > '2014-04-01 12:01:00' grouping c.customers_id order c.points_date_added desc limit 100
select customers_id, count(points_comment) duplicate_rows customers_points grouping customers_id, points_comment
mysql sql having
Comments
Post a Comment