Eliminate Duplicate Records in a Query (1 Viewer)

jereece

Registered User.
Local time
Today, 00:21
Joined
Dec 11, 2001
Messages
300
I know there a many posts about eliminating duplicate records because I did search, but I did not see anything that really answers my question.

I have a query in a local Access database that is using a Linked table from an SQL database managed by our corporate IT department. I have read access to only certain tables / fields in the SQL database. My query is based on 3 tables from the database and I have them linked together in my query.

When managers move from one site to another, they are given a different TeamID number. However, until they are replaced, the manager will have more than one TeamID assigned to him in the SQL database. Evidentally, the way our IT has the SQL database structured, when I query open items it duplicates the record for that manager because he has 2 TeamID numbers. So the only field that comes up differnt in the duplicate records is the manager's TeamID number.

I would like for my Select Query to ignore the duplicate record. I know I can use an Append Query to copy the data temporarily to a local table and set the proper fields as Primary Keys to do this. However, it would be nice if I did not have to go to all that trouble.

Is there a way to eliminate duplicate in my Select Query?

As always, I appreciate the help.

Jim
 

boblarson

Smeghead
Local time
Yesterday, 16:21
Joined
Jan 12, 2001
Messages
32,059
There are different ways to do this. One way that I've used in the past is to first create a query that pulls the manager with their current id for the team they currently are assigned to. Not sure how you would determine that without something like a date stamp of when they got assigned, but if you can...

Then I nest that query inside another that pulls the appropriate data.
 

Len Boorman

Back in gainfull employme
Local time
Today, 00:21
Joined
Mar 23, 2000
Messages
1,930
If you do not actually need the ID then leave it out of your query. Add the word distinct to the sql statement immediately after the word SELECT

SELECT distinct etc
L
 

Users who are viewing this thread

Top Bottom