Where / And - Not so specific
Posted: Tue Sep 16, 2008 11:38 am
I my database has people and their memberships. A person can have multiple memberships. Right now, the query only returns people with the membership id of 10, which is correct but it ignores their other memberships. How can I make the query only list people with a membership id of 10 but also list their other memberships? Is there a way to say mebership id contains 10?
[sql] SELECT GROUP_CONCAT(membership_name ORDER BY M.membership_id SEPARATOR ', ') AS membership_name, P.people_id, people_fname, people_mname, people_lnameFROM membership M, people_membership PM, people P,people_title PTWHERE M.membership_id=PM.membership_id AND P.people_id=PM.people_id AND P.people_id=PT.people_id AND M.membership_id=10 GROUP BY P.people_idORDER BY P.people_lname ASC [/sql]
[sql] SELECT GROUP_CONCAT(membership_name ORDER BY M.membership_id SEPARATOR ', ') AS membership_name, P.people_id, people_fname, people_mname, people_lnameFROM membership M, people_membership PM, people P,people_title PTWHERE M.membership_id=PM.membership_id AND P.people_id=PM.people_id AND P.people_id=PT.people_id AND M.membership_id=10 GROUP BY P.people_idORDER BY P.people_lname ASC [/sql]