• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 322
  • Last Modified:

Locate Duplicate ids in MySQL table

I have a table called MLSIDS that has a column called ListingID.  This column is not the primary key.  1.) What query can I issue to show me all duplicate ListingIDs in the table?
2.) What query can I issue to give me a count of all duplicates?
0
pda4me
Asked:
pda4me
  • 2
  • 2
1 Solution
 
kivan24Commented:
select ListingID, count(ListingID) from MLSIDS group by ListingID

Open in new window

0
 
pda4meAuthor Commented:
close, I need to just show the ids that are duplicates...this shows all 25K records.
0
 
kivan24Commented:
Try:
select ListingID, count(ListingID) as idcnt from MLSIDS group by ListingID having idcnt > 1

Open in new window

0
 
pda4meAuthor Commented:
Excellent, thanks a bunch!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now