I am working with a database that has some duplicate data and am trying to write a query that will pull the problem data. The table looks like:
lpID, pID, pName, etc...
where lpID is the unique id for this table and pID is a shared id for the whole db. I have this to pull matching pID values (16k):
SELECT lp.pID, group_concat(lp.lpID) as lpIDs, group_concat(lp.pName) as names
FROM lp
INNER JOIN (
SELECT pID
FROM lp
GROUP BY pID
HAVING count(pID) > 1
) dup ON lp.pID = dup.pID
group by lp.pID
Which works, but now I am trying to extend it such that it only pulls the 938 that have mismatched pName values. Nothing that I try seems to work. How can I get that done?
Have you tried