|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
MySQL table joins
I have these tables:
"user" ------------- id int email varchar "group_tbl" ------------ id int owner_id int name varchar "group_list" --------------- gid int uid int user.id is the unique numeric id of each user in this system user.email is the full email address of each user in this system group_tbl.id is the unique numeric id of each group in this system group_tbl.owner_id is the id of the user responsible for this group group_tbl.name is the full name for each group in this system group_list.gid is a numeric group id group_list.uid is a numeric user id The user table lists everybody; the "group_tbl" lists all the groups that people can belong to; and, the "group_list" table shows who belongs to what group. You can belong to any or all groups or none. The group_list table is initially empty until members are added. I'm writing an app to allow an authorized person to manage the users and groups. In the group management part under membership I can have the admin pick the group he wants to work with. This works. The hard part is that I want to show the admin two lists of users. The first list [the one kicking me hard] is a list of ALL users that are NOT the owner OR otherwise a member of this particular group. The second list are the current members [easy]. Owners are not [currently] listed as "members" of their groups. The result will be a web form where you can pick non-members to add to the group and vice-versa. I just can't seem to generate the list of non-members. I'm using a very recent version of MySQL |
|
#2
|
|||
|
|||
|
RE: MySQL table joins
|
|
#3
|
|||
|
|||
|
RE: MySQL table joins
Hey! this is great, thank you!
A question though. The LEFT JOIN is pulling in all the non-group members including the group owner. Is it possible to get a list of all NON-members that doesn not in clude the owner? Or, would it be easier to include the owner in the membership list? Dean...K... |
|
#4
|
|||
|
|||
|
RE: MySQL table joins
Also a big thanx on behalf of me! I came across exactly the same problem with two lists a couple of weeks ago. Nobody could help me, newsgroups, forums, collegues, you name it. A big hurray for the codewalkers forum (and especially for zombie ;-) )!
Tom |
|
#5
|
|||||
|
|||||
|
RE: MySQL table joins
but that part is easy.. you realy should try to do smth yourself..
anyway, just add another condition in the where clausole: php Code:
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > MySQL table joins |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|