-
query help
I was hoping someone could help me with a query...I am thinking that I need an 'IN' statement, however I am not sure. Here is what my tables look like:
tblGroups
---------
group
---------
groupA
groupB
groupC
tblBridge
---------
user | group
---------
userA | groupA
userA | groupB
userB | groupC
userC | groupA
Basically I want my query to show only the groups that userA is NOT a member of...which is just gorupC. Any ideas?
-
select group from tblGroups
where group not in
(
select group by tblBridge where user='userA'
)
... or ...
select group from tblGroups
minus
select group by tblBridge where user='userA'
... or ...
select group from tblGroups g
where not exists
(
select group by tblBridge t where user='userA'
and t.group = g.group
)
... or ...
some other methods.
I like the minus operator.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|