duplicate results

I have imported a set of data from an excel spreadsheet with around 10 fields. in one field (called concatenate), there will be a number of duplicates based on these sequence of numbers. However, there is another field called name. I need a way to query the data to essentially, select all rows where if concatenate is the same but the name is different. for example there will be rows where the concatenate field is the same on different rows of data, but the name field could either be the same for all those rows, or different names, I only want to see unique records, so for example from the below data

concatenate name
123456  pma111
123456 pma111
123456 abc111
67890 pma111
67890 pma111
67890 acb111
88888 pma111
88888 pma1111


the query above should only show

123456 pma111
123456 abc111
67890 pma111
67890 abc111

(and it would return no results for 88888 as their is only ever 1 name associated with 67890). I only want where for each unique concatenate value, a list of unique names associated with that value. If there is only 1 unique value associated with the concatenate, I am not interested in the results. I need the results to include all fields in this table if that complicates things..
LVL 3
pma111Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
You'd be better off either Importing or Linking the workbook, and then using standard VBA/SQL methods to determine if there is a duplicate. Note that if you import, you should import to a temporary table before you actually move your data to a live table.

To check for duplicates, use a DISTINCT query:

SELECT DISTINCT Concatenate, Name FROM YourTempTable

I need the results to include all fields in this table if that complicates things..
That's going to be difficult to do, since you're essentially eliminating one or more rows in your scenario. For example, if you have 3 rows that contain the same value in Concatenate and Name, you only want to see one of those rows - but which one?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Rgonzo1971Commented:
HI,

pls try

SELECT First(myTable.[concatenate name]) AS concatenate name Field]
FROM myTable
GROUP BY myTable.[concatenate name]
HAVING ((Count(myTable.[concatenate name]))>1);

Open in new window

Regards
0
pma111Author Commented:
>you only want to see one of those rows - but which one?

It doesnt really matter, the first is sufficient..
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

pma111Author Commented:
@rgonzo1971

this produes errors, for example mytable in this case is called duplicates

SELECT First(duplicates.[concatenate name]) AS concatenate name Field]
FROM duplicates
GROUP BY duplicates.[concatenate name]
HAVING ((Count(duplicates.[concatenate name]))>1);

"concatenate" and "name" are 2 different fields in this table. Running the above query exactly returns the error "the SELECT statement includes a reserved word or argument name that is misspelled or missing, or the punctuation is incorrect"
0
Rgonzo1971Commented:
Sorry

 SELECT First(duplicates.[concatenate name]) AS [concatenate name Field]
 FROM duplicates
 GROUP BY duplicates.[concatenate name]
 HAVING ((Count(duplicates.[concatenate name]))>1);

Open in new window

0
pma111Author Commented:
that query now prompts me to enter parameter value for duplicates concatenate name
0
Rgonzo1971Commented:
is the field name
concatenate name
or
concatenate
if so
 SELECT First(duplicates.[concatenate]) AS [concatenate Field]
 FROM duplicates
 GROUP BY duplicates.[concatenate]
 HAVING ((Count(duplicates.[concatenate]))>1);

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.