November 30, 2003 at 1:09 am
Hi,
I'm having trouble with the following statement
SELECT MemberID, UserName
FROM tblUsers, tblProfile
WHERE
tblProfile.Education = 'Some College'
OR tblProfile.Education = 'Associates Degree'
AND tblProfile.MemberIDpr = tblUsers.MemberID
ORDER BY MemberID DESC
The 'OR' call generates tons of redundant records.
Is there an easy way to do this?
What should I use instead of OR ?
Thanks in advance
Rick
November 30, 2003 at 9:49 am
I am not sure what you are trying to accomplish but I think you want this:
SELECT DISTINCT MemberID, UserName
FROM tblUsers JOIN tblProfile on tblProfile.MemberIDpr = tblUsers.MemberID
WHERE
tblProfile.Education IN ('Some College', 'Associates Degree')
ORDER BY MemberID DESC
to help more I may need to know how the tables are linked I just assumed a bunch of things
* Noel
November 30, 2003 at 5:08 pm
Use brackets in your where clause.
...
WHERE
(
tblProfile.Education = 'Some College'
OR tblProfile.Education = 'Associates Degree'
)
AND tblProfile.MemberIDpr = tblUsers.MemberID
...
Cheers,
Kevin
November 30, 2003 at 6:57 pm
Thanks Dogeth
It worked great!
quote:
Use brackets in your where clause....
WHERE
(
tblProfile.Education = 'Some College'
OR tblProfile.Education = 'Associates Degree'
)
AND tblProfile.MemberIDpr = tblUsers.MemberID
...
December 1, 2003 at 8:04 am
Is there a specific reason for doing the join criteria in the where rather than in the join clause? Using the join is ANSI standard.
Joe Johnson
NETDIO,LLC.
Joe Johnson
NETDIO,LLC.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply