Hide Row based on duplicate data in selected field

I have a SQL query in MS Access that doesn't seem to be working correctly.  Basically I want to hide rows of data that contain the same email address.  My query is hiding all entries with the same email address when I still need to see one.

SELECT DISTINCT Query1.SizeSmall, Query1.ID, Query1.CorpContact, Query1.EmailHyperlink, Query1.CategoryID, tblCategories.Category
FROM Query1 INNER JOIN tblCategories ON Query1.CategoryID = tblCategories.CategoryID
GROUP BY Query1.SizeSmall, Query1.ID, Query1.CorpContact, Query1.EmailHyperlink, Query1.CategoryID, tblCategories.Category, [Query1.EmailHyperlink]
HAVING ((([Query1.EmailHyperlink]) In (SELECT [EmailHyperlink] FROM [Query1] As Tmp GROUP BY [EmailHyperlink] HAVING Count(*)=1 )))
ORDER BY Query1.SizeSmall;

Open in new window



This is for an emailing system where my end user can select categories of people to send to.
napsternovaDeveloperAsked:
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.

Jeffrey CoachmanMIS LiasonCommented:
Not sure I fully understand...

But a simple query like this will list al of the unique emails in a table.

SELECT YourTable.EmailAddress
FROM YourTable
GROUP BY YourTable.EmailAddress;

JeffCoachman
0
PatHartmanCommented:
Duplicates can be pesky to handle.  Your query includes many columns in addition to the email and therefore a Group By will not solve the problem.  You need to use Group By for ONLY the email address and then use First() for all the other columns since you don't seem to care what the other values are.  You could use Min or Max for dates but First works as well as anything for all the other values.
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
MacroShadowCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: PatHartman (http:#a40244390)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

MacroShadow
Experts-Exchange Cleanup Volunteer
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.