hey there,
I want to do the following, but can't write the correct statement:
Tables:
tbl_user
user_id | username
tbl_group
group_id | groupname
tbl_useringroup
user_id | group_id
All I want is to select all tbl_group.groupname where the user is not in. (the goal is to show a selectbox with only the groups the user is not assinged)
I tried the following, but its sh*t
SELECT DISTINCT tbl_group.group_id, tbl_group.groupname FROM tbl_group, tbl_useringroup
WHERE tbl_useringroup.gruppenid <> tbl_group.group_id
AND tbl_useringroup.userid = '$userid'
hope you can help me,
thx && greets, ben
I want to do the following, but can't write the correct statement:
Tables:
tbl_user
user_id | username
tbl_group
group_id | groupname
tbl_useringroup
user_id | group_id
All I want is to select all tbl_group.groupname where the user is not in. (the goal is to show a selectbox with only the groups the user is not assinged)
I tried the following, but its sh*t
SELECT DISTINCT tbl_group.group_id, tbl_group.groupname FROM tbl_group, tbl_useringroup
WHERE tbl_useringroup.gruppenid <> tbl_group.group_id
AND tbl_useringroup.userid = '$userid'
hope you can help me,
thx && greets, ben