Hi.
On Thu, Feb 22, 2001 at 03:50:22PM +0100, [EMAIL PROTECTED] wrote:
> I have three tables:
> one with contacts,
> one with members, and
> one that links the members to a group.
>
> How do I make a SQL-string, that gets the members from a specifik group, AND
> the contacts that belongs to this group as well?
SELECT m.name, g.name, c.name
FROM members m, contacts c, group_members g
WHERE m.id = g.member_id AND
g.id = 12345 AND
g.contacts_id = c.id
If this isn't like what you want, please post again and include the
SELECTs you already have belonging to the seperate inner joins.
> Won't I have to make a double InnerJoin?
Yes, but what is the problem with that?
If you use the INNER JOIN ... ON syntax, you just have to move the
WHERE clause parts around:
SELECT m.name, g.name, c.name
FROM members m
INNER JOIN group_members g ON m.id = g.member_id
INNER JOIN contacts c ON g.contacts_id = c.id
WHEHRE g.id = 12345
Bye,
Benjamin.
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php