I’m trying to make an recepient list from several of tables. As it is now The script is getting all the users in the same group as the "asking ". Like this:
$sql = "SELECT
u.new_userid
, u.fname
, u.lname
, u.email
FROM fb_users u
INNER JOIN fb_club_users cu
ON cu.new_userid = u.new_userid
INNER JOIN
(SELECT
clubid
FROM fb_club_users
WHERE new_userid = $userid
) AS c
ON c.clubid = cu.clubid
WHERE u.new_userid <> $userid";
But I want to add another table to the query without the risk of getting duplicates. The new table looks as follows:
id, user, friend, active
I want top find all the current userfriends and get them into the query. But the user might have a friend which is also in a group. So how do I get all the friends out without making a duplkicate if the friend also is in one of the users groups?!?!?
Hope this makes sense…