Three Table Query Help
Posted: Fri Oct 26, 2007 12:24 pm
feyd | Please use
Any help would be greatly appreciated.
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I have three tables:
- people, has a persons info
- membership, has a list of memberships
- people_membership, which has people_id and membership_id
Here's what I want to happen:
- Get the persons info from PEOPLE
- Use the ID from PEOPLE and check what MEMBERSHIP ID's are associted with it in PEOPLE_MEMBERSHIP
- Match the MEMBERSHIP_ID's in the MEMBERSHIP table
* A person can have multiple memberships
[syntax="sql"]
SELECT people.people_id, people.people_fname, people.people_mname, people.people_lname, people_membership.membership_id
FROM people,people_membership
WHERE people.people_title=$tid
AND people.people_id=people_membership.people_id
(SELECT membership.membership_name
FROM membership
WHERE membership.membership_id=people_membership.membership_id)
feyd | Please use[/syntax]
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]