Duplicates

Duplicates

am 06.09.2005 06:27:20 von Doug

I keep getting duplicates when I use this statement to pull from an Access
2002 database:

mySQL="SELECT DISTINCT tblEvents.EventID, tblEvents.EventName,
tblEventType.EventType, tblEvents.StartTime, tblEvents.EndTime,
tblOrg.OrgName FROM tblOrg INNER JOIN (tblEventType INNER JOIN
((tblClassification INNER JOIN tblEvents ON
tblClassification.ClassID=tblEvents.EventClassification) INNER JOIN
[tblOrg-Event] ON tblEvents.EventID=[tblOrg-Event].EventID) ON
tblEventType.EventTypeID=tblEvents.EventType) ON
tblOrg.OrgID=[tblOrg-Event].OrgID WHERE (((tblOrg.OrgName)= 'home' or
'work' )) ORDER BY tblEvents.StartTime;"

It's the 'home' or 'work' portion that gets the duplicates. It is
apparently finding anything with home, work or both home and work etc... and
I have many duplicate records in the recordset by using this. The DISTINCT
appears to do nothing, but I am likely using it wrong. I don't want any
records having the same EventID to show up in the recordset. I know this is
probably the wrong way to go about doing what I want, but I'm looking for
any advice.

Thanks,

Doug

Re: Duplicates

am 06.09.2005 12:48:27 von reb01501

Show us some sample data and intended results. A picture is worth a thousand
words ...

Doug wrote:
> I keep getting duplicates when I use this statement to pull from an
> Access 2002 database:
>
> mySQL="SELECT DISTINCT tblEvents.EventID, tblEvents.EventName,
> tblEventType.EventType, tblEvents.StartTime, tblEvents.EndTime,
> tblOrg.OrgName FROM tblOrg INNER JOIN (tblEventType INNER JOIN
> ((tblClassification INNER JOIN tblEvents ON
> tblClassification.ClassID=tblEvents.EventClassification) INNER JOIN
> [tblOrg-Event] ON tblEvents.EventID=[tblOrg-Event].EventID) ON
> tblEventType.EventTypeID=tblEvents.EventType) ON
> tblOrg.OrgID=[tblOrg-Event].OrgID WHERE (((tblOrg.OrgName)= 'home' or
> 'work' )) ORDER BY tblEvents.StartTime;"
>
> It's the 'home' or 'work' portion that gets the duplicates. It is
> apparently finding anything with home, work or both home and work
> etc... and I have many duplicate records in the recordset by using
> this. The DISTINCT appears to do nothing, but I am likely using it
> wrong. I don't want any records having the same EventID to show up
> in the recordset. I know this is probably the wrong way to go about
> doing what I want, but I'm looking for any advice.
>
> Thanks,
>
> Doug

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: Duplicates

am 08.09.2005 03:43:28 von Bullschmidt

I don't know if this will totally solve your problem but I would suggest
changing this:

WHERE (((tblOrg.OrgName)= 'home' or 'work' ))

To be more like this instead:

WHERE (((tblOrg.OrgName) = 'home') OR ((tblOrg.OrgName) = 'work'))

Or without so many parentheses:

WHERE (tblOrg.OrgName = 'home') OR (tblOrg.OrgName = 'work')

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...

<<
I keep getting duplicates when I use this statement to pull from an
Access
2002 database:

mySQL="SELECT DISTINCT tblEvents.EventID, tblEvents.EventName,
tblEventType.EventType, tblEvents.StartTime, tblEvents.EndTime,
tblOrg.OrgName FROM tblOrg INNER JOIN (tblEventType INNER JOIN
((tblClassification INNER JOIN tblEvents ON
tblClassification.ClassID=tblEvents.EventClassification) INNER JOIN
[tblOrg-Event] ON tblEvents.EventID=[tblOrg-Event].EventID) ON
tblEventType.EventTypeID=tblEvents.EventType) ON
tblOrg.OrgID=[tblOrg-Event].OrgID WHERE (((tblOrg.OrgName)= 'home' or
'work' )) ORDER BY tblEvents.StartTime;"

It's the 'home' or 'work' portion that gets the duplicates. It is
apparently finding anything with home, work or both home and work etc...
and
I have many duplicate records in the recordset by using this. The
DISTINCT
appears to do nothing, but I am likely using it wrong. I don't want any
records having the same EventID to show up in the recordset. I know this
is
probably the wrong way to go about doing what I want, but I'm looking
for
any advice.

Thanks,

Doug
>>


*** Sent via Developersdex http://www.developersdex.com ***