Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Add ID number to potential duplicate query

Posted on 2014-04-01
1
Medium Priority
?
266 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 40

Accepted Solution

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

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

772 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