A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access duplicates query



 
 
Thread Tools Display Modes
  #1  
Old December 16th, 2008, 03:37 PM posted to microsoft.public.access.queries
mehstg1319
external usenet poster
 
Posts: 5
Default Access duplicates query

Hi people

I have an access query I am trying to implement in a database....due
to the nature of the data it is selecting...there will be duplicate
entries (the data is for a series of events and finds people who have
visited the events. Therefore, if a person has visited more than one
event, they will show more than once).

Basically, I am trying to produce a query to give me all the email
addresses in the dataset, without duplicates...but I cannot get it to
work for love nor money....I understand that it could possibly be done
using the GROUP BY command....but when I try that, I get all kinds of
aggregation errors.

The query is as follows:
-----------------------------------------------------------------------------------------------------------------------------
SELECT TblMember.[preferred email], tblworkshops.WorkshopTitle,
Tblmember.title+' '+Tblmember.firstname+' '+Tblmember.surname AS
[Member Name]
FROM TblMember, Tblbooking, tblworkshops
WHERE (((tblworkshops.WorkshopDate) Between #1/1/2001# And
#1/20/2008#) AND ((TblMember.TrueMember)=Yes) AND ((TblMember.memberid)
=[tblbooking].[memberid]) AND ((Tblbooking.workshopid)=[tblworkshops].
[workshopid]) AND ((tblworkshops.Wednesday)=Yes));

--------------------------------------------------------------------------------------------------------------------------------

Hopefully someone can help me.

Regards

Paul
  #2  
Old December 16th, 2008, 03:52 PM posted to microsoft.public.access.queries
Roger Carlson
external usenet poster
 
Posts: 824
Default Access duplicates query

Have you tried adding the DISTINCT predicate?

SELECT DISTINCT TblMember.[preferred email], tblworkshops.WorkshopTitle,...


--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L





"mehstg1319" wrote in message
...
Hi people

I have an access query I am trying to implement in a database....due
to the nature of the data it is selecting...there will be duplicate
entries (the data is for a series of events and finds people who have
visited the events. Therefore, if a person has visited more than one
event, they will show more than once).

Basically, I am trying to produce a query to give me all the email
addresses in the dataset, without duplicates...but I cannot get it to
work for love nor money....I understand that it could possibly be done
using the GROUP BY command....but when I try that, I get all kinds of
aggregation errors.

The query is as follows:
-----------------------------------------------------------------------------------------------------------------------------
SELECT TblMember.[preferred email], tblworkshops.WorkshopTitle,
Tblmember.title+' '+Tblmember.firstname+' '+Tblmember.surname AS
[Member Name]
FROM TblMember, Tblbooking, tblworkshops
WHERE (((tblworkshops.WorkshopDate) Between #1/1/2001# And
#1/20/2008#) AND ((TblMember.TrueMember)=Yes) AND ((TblMember.memberid)
=[tblbooking].[memberid]) AND ((Tblbooking.workshopid)=[tblworkshops].
[workshopid]) AND ((tblworkshops.Wednesday)=Yes));

--------------------------------------------------------------------------------------------------------------------------------

Hopefully someone can help me.

Regards

Paul



  #3  
Old December 16th, 2008, 03:58 PM posted to microsoft.public.access.queries
mehstg1319
external usenet poster
 
Posts: 5
Default Access duplicates query

On 16 Dec, 15:52, "Roger Carlson"
wrote:
Have you tried adding the DISTINCT predicate?

SELECT DISTINCT TblMember.[preferred email], tblworkshops.WorkshopTitle,....

--
--Roger Carlson
* MS Access MVP
* Access Database Samples:www.rogersaccesslibrary.com
* Want answers to your Access questions in your Email?
* Free subscription:
*http://peach.ease.lsoft.com/scripts/...UBED1=ACCESS-L

"mehstg1319" wrote in message

...



Hi people


I have an access query I am trying to implement in a database....due
to the nature of the data it is selecting...there will be duplicate
entries (the data is for a series of events and finds people who have
visited the events. Therefore, if a person has visited more than one
event, they will show more than once).


Basically, I am trying to produce a query to give me all the email
addresses in the dataset, without duplicates...but I cannot get it to
work for love nor money....I understand that it could possibly be done
using the GROUP BY command....but when I try that, I get all kinds of
aggregation errors.


The query is as follows:
---------------------------------------------------------------------------*--------------------------------------------------
SELECT TblMember.[preferred email], tblworkshops.WorkshopTitle,
Tblmember.title+' '+Tblmember.firstname+' '+Tblmember.surname AS
[Member Name]
FROM TblMember, Tblbooking, tblworkshops
WHERE (((tblworkshops.WorkshopDate) Between #1/1/2001# And
#1/20/2008#) AND ((TblMember.TrueMember)=Yes) AND ((TblMember.memberid)
=[tblbooking].[memberid]) AND ((Tblbooking.workshopid)=[tblworkshops].
[workshopid]) AND ((tblworkshops.Wednesday)=Yes));


---------------------------------------------------------------------------*-----------------------------------------------------


Hopefully someone can help me.


Regards


Paul- Hide quoted text -


- Show quoted text -


Doesnt seem to make any difference.....have changed it to read:
SELECT DISTINCT TblMember.[preferred email],
tblworkshops.WorkshopTitle, Tblmember.title+' '+Tblmember.firstname+'
'+Tblmember.surname AS [Member Name]


Paul
  #4  
Old December 16th, 2008, 05:02 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Access duplicates query

You have to remove the tblworkshops.WorkshopTitle from the list of returned
fields. Otherwise you are going to get one row for each combo of member and
workshop.

I would write that SQL as follows:

SELECT DISTINCT TblMember.[preferred email]
, (Tblmember.title + ' ') & (Tblmember.firstname + ' ') & Tblmember.surname AS
[Member Name]
FROM (tblMember INNER JOIN tblBooking
ON tblMember.MemberID = tblBooking.MemberID)
INNER JOIN TblWorkshops
ON tblBooking.worksshopId = tblWorkshops.WorkShopId
WHERE tblworkshops.WorkshopDate Between #1/1/2001# And
#1/20/2008#
AND TblMember.TrueMember=Yes
AND tblworkshops.Wednesday=Yes


John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County

mehstg1319 wrote:
Hi people

I have an access query I am trying to implement in a database....due
to the nature of the data it is selecting...there will be duplicate
entries (the data is for a series of events and finds people who have
visited the events. Therefore, if a person has visited more than one
event, they will show more than once).

Basically, I am trying to produce a query to give me all the email
addresses in the dataset, without duplicates...but I cannot get it to
work for love nor money....I understand that it could possibly be done
using the GROUP BY command....but when I try that, I get all kinds of
aggregation errors.

The query is as follows:
-----------------------------------------------------------------------------------------------------------------------------
SELECT TblMember.[preferred email], tblworkshops.WorkshopTitle,
Tblmember.title+' '+Tblmember.firstname+' '+Tblmember.surname AS
[Member Name]
FROM TblMember, Tblbooking, tblworkshops
WHERE (((tblworkshops.WorkshopDate) Between #1/1/2001# And
#1/20/2008#) AND ((TblMember.TrueMember)=Yes) AND ((TblMember.memberid)
=[tblbooking].[memberid]) AND ((Tblbooking.workshopid)=[tblworkshops].
[workshopid]) AND ((tblworkshops.Wednesday)=Yes));

--------------------------------------------------------------------------------------------------------------------------------

Hopefully someone can help me.

Regards

Paul

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.