query

  • Thread starter Thread starter Pass-the-Reality
  • Start date Start date
P

Pass-the-Reality

I have a query that returns the records ID number, Phone Number and Name.
When I run my query, there are not any duplicate ID numbers, but there are
duplicate phone numbers. The reason is, there are individual records where
the same phone number was entered. How can I run a query to show that ONLY
shows those records with duplicate phone numbers? Example. I only want to
see the below records 2 and 3

ID Phone Name
1 5555555 Mike
2 6666666 Lisa
3 6666666 Jeff
 
Select *
From YourTable
Where Phone In (
Select Phone
From YourTable
Group By Phone
Having Count(phone) >1)
Order by Phone, Name;

Make sure that the table and field names are correct especially both
"YourTable"s.
 
This will give you the phone numbers that are duplicated. If you need to
know which records have the duplication, you can do a join on phone number
back to YourTable to see the ID numbers
 
This will give you the phone numbers that are duplicated. If you
need to know which records have the duplication, you can do a join
on phone number back to YourTable to see the ID numbers

SuzyQ,

Jerry's SQL does return the whole row including the id numbers.

Q
 
Back
Top