I have a query results that is similar to the following:
Part ID | Company |
---|---|
102 | ABC Corp |
102 | XYZ Corp |
103 | ABC Corp |
104 | EFG Corp |
104 | HIJ Corp |
This table is created with a simple query such as SELECT part_id, company FROM MyTable
However, I only want to return rows where the part ID number occurs more than once, i.e. I want the ‘103’ part ID row taken out, as it has only one listing.
I tried using COUNT(*)
but this returns ‘1’ as the rows are always going to be unique. I want to remove rows where the COUNT of the total occurrences of a Part ID is only 1.
2
Answers
Try this:
You can use
Output will be