Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8810511
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:08:12+00:00 2026-06-14T03:08:12+00:00

I am working with a database that has some duplicate data and am trying

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:08:13+00:00Added an answer on June 14, 2026 at 3:08 am

    Have you tried

    SELECT lp.pID, group_concat(lp.lpID) as lpIDs, group_concat(lp.pName) as names
    FROM lp
    INNER JOIN (
      SELECT pID, COUNT(distinct pName) AS Names
      FROM lp
      GROUP BY pID
      HAVING count(pID) > 1 AND Names > 1
    ) dup ON lp.pID = dup.pID
    group by lp.pID
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working with a MySQL database that has some data imported from Excel .
I'm working on a legacy database table that has a phone no. field but
Working on a website that has Employee and Branch entities, using a database table
The database I'm working against has table names such as table_name. That's fine, but
I have a database I'm working on that has some queries showing up in
I am getting some data from database that has date break up in year
I'm working with a database that has a bunch of serial numbers that are
I'm working with an existing database that has first name and last name seperated
I'm working on a database site now that has the URL structure: example.com/f.php?id=12 I'd
I'm working on an application that has a read-only database shipped with it. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.