Solved

Add ID number to potential duplicate query

Posted on 2014-04-01
1
259 Views
Last Modified: 2014-04-03
Hello Experts.

I am working on a query that I just can't get to work the way I need.  I have written the following query that identifies subject names (subjectName) that exist more than once in the table:

SELECT multipleSubjectNameQry.subjectName
FROM multipleSubjectNameQry
GROUP BY multipleSubjectNameQry.subjectName
HAVING ((Count(*))>1);

Open in new window


But I need this query to also display the record number (primary key).  But, when I add the primary key field the query doesn't return anything because the results are no longer duplicates.  How can I modify this query so that it provides the list of subject names that exist more than once, along with their record numbers?

Any help would be greatly appreciated.  I am working with MS Access 2013 on Windows 7.

Also, I have tried the following, but it doesn't work either:

SELECT multipleSubjectNameQry.subjectName, multipleSubjectNameQry.myID
FROM multipleSubjectNameQry
GROUP BY multipleSubjectNameQry.subjectName, multipleSubjectNameQry.myID
HAVING (((Count(multipleSubjectNameQry.subjectName))>1));

Open in new window



Thanks,
J
0
Comment
Question by:ferguson_jerald
1 Comment
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points
ID: 39970393
Use the Find Duplicates wizard to create the query.  You can have it return whatever you want.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now