For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > September 2004 > Newbie question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Newbie question
Nick

2004-09-24, 4:00 pm

I have 2 dbs

a)Relation
User | Group
4 | 2
4 | 3
5 | 4
5 | 5
4 | 4

b)Group
ID | Name
2 | Grp1
3 | Grp2
4 | Grp3
5 | Grp4


What i would like to do is get a result set of
Relation.Group, Group.Name
5, Grp4

Info at hand before query is user=4, so what i am looking for is all
groups that are not subscribed by user 4.

So far i tried:
$Query = 'SELECT DISTINCT usergroup_relation.group, group.Name
FROM `group`, `usergroup_relation` WHERE usergroup_relation.user !=
\''.$userid.'\' AND usergroup_relation.group = group.id';

This just gives me all groups that do not have user=4.

How do i modify it.
Thanks in advance.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com