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)
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 get this error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT membership_name FROM membership WHERE membership.membership_id=peopl' at line 5"
I've sort of had the query working before using left joins but it returned each record a ton of times.