given this, how would you write a query to list all members that are part of group_id=1 AND group_id=2 AND ... group_id 20..... without having to write 20 "JOIN relationship r1 on r1.group_id =1 .... JOIN relationship r20 on r20.group_id =20) wich gets extremely slow with large ammounts of JOINS....
On Wednesday 11 June 2003 08:47 pm, JJ wrote: > I have to add group functionality to an existing database. The > functionality required will be something like /etc/group in linux. How about 3 tables. Groups, Members, and Relationships. Table Group id int auto_increment name char Table Member id int auto_increment name char Table Relationship group_id int member_id int this makes queries like: select member.name from group,member,relationship where group.name='Group Foo' and relationship.group_id=group.id and relationship.member_id=member.id; select group.name from group,member,relationship where member.name='Joe Bar' and relationship.group_id=group.id and relationship.member_id=member.id; Ryan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]