use an OR clause (to get all forumCategoryID=5 or forumsections for
USERID=84).
SELECT forumSection.*
FROM forumSection
WHERE (forumCategoryID = 5) OR (forumSectionID IN
(SELECT forumUsers.ForumID
FROM forumUsers
WHERE (forumUsers.UserID = 84)))
Brian Freeman
(xxx) xxx-xxxx ext. 415
Carnegie Technologies/Bluewave Computing
www.carnegie.com and www.bluewave-computing.com
-----Original Message-----
From: Julian Voelcker [mailto:asp@t...]
Sent: Tuesday, January 14, 2003 9:53 AM
To: sql language
Subject: [sql_language] Re: Pls Help with Query - alternatives to
DISTINCT ?
Hi Brian,
Thanks, for that, but it doesn't quite get there...
The original query returned three records with two of them being duplicates
of the same forumSection.
Your version returns just one record (the one that wasn't being duplicated).
Any more ideas?
PS - there was a minor syntax error with your code - I have ended up with...
SELECT forumSection.*
FROM forumSection
WHERE (forumCategoryID = 5) AND (forumSectionID IN
(SELECT forumUsers.ForumID
FROM forumUsers
WHERE (forumUsers.UserID = 84)))
On Tue, 14 Jan 2003 07:22:03 -0500, Brian Freeman wrote:
> Use a subquery with an IN clause:
>
> SELECT forumSection.*
> FROM forumSection
> where ((forumSection.forumCategoryID = 5) and
> (forumSection.forumSectionID in (select forumUsers.ForumID from forumUsers
> where (forumUsers.UserID = 84)))
>
Cheers,
Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom