De Duplicate Query

G

Guest

Hello,
In the Table I have 3 col.
ID Name Country
1 Boston Bank USA
2 Boston Bank Canada
3 Boston Bank Paris
ID is the unique value of the Table.

I need to run a querry to extract :Give all records where "Name" is the same
and "Country" is diferent.
Can someone help me on this?

Thank you
Bob
 
K

Keith Leslein

You can set up a standard select query and set the query properties
Unique Values option to yes. This will show you all listings with
distinct values. It may show you multiple values if the Bank Name is
the same and in a different country or region as this will be a unique
entry. This sounds like what you are looking for based off the
information provided.
 
J

John Spencer

Do you have records that repeat the value? That is with your limited set,
might you have
21 Boston Bank USA

Or must the combination of Name and Country be unique?

If the combination is unique, then all you really need is
SELECT *
FROM YourTable
WHERE Name IN
(SELECT [Name] FROM YourTable GROUP BY [Name] HAVING Count([Name])>1)

If the combination is not unique then you have to get a distinct list first.
With your naming scheme and Access this will probably mean a stacked query
solution.

QueryOne
SELECT Distinct [Name] as TheName, Country
FROM YourTable

SELECT *
FROM YourTable
WHERE Name IN
(SELECT TheName FROM QueryONE GROUP BY TheName HAVING Count(TheName)>1)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Dcount returning no results!!! 0
LIKE Query 2
Two tables one query 5
Using LookUp tables in sql query,need help 7
What's wrong with this query?! 5
query help 5
Recursive(?) Query 2
Query not return all records 1

Top