heatherdamnit Posted October 12, 2007 Share Posted October 12, 2007 Hi, I am setting up a member website/buyer's guide. I have 3 tables. My tables are Member - which holds the member details such as MemberID company name, phone, web, etc. Categories - which holds the CategoryID and CategoryName. And MemberCategory which holds the MemberCategoryID, f_MemberID (foreign key to members table) and f_CategoryID (foreign key to Category table). I have set up a jump menu at http://www.aafw.org/Association/AssocBuyersGuide2.php to pull the Category Names from the Categories table. Now I just need it to be able to when a user selects a category from that list to go to a page that lists all of the companies who belong to that category. Right now I'm using this code: SELECT Member.MemberID, Member.CompanyName, Member.Phone, Member.TollFree, Member.Fax, Member.Address, Member.City, Member.`State`, Member.Zip, Member.Website, Member.Descriptions, Member.Email, MemberCategory.MemberCategoryID, MemberCategory.f_MemberID, MemberCategory.f_CategoryID, Categories.CategoryID, Categories.CategoryName FROM Member, MemberCategory, Categories WHERE Categories.CategoryID = MemberCategory.f_CategoryID AND MemberCategory.f_MemberID = Member.MemberID ORDER BY Member.CompanyName ASC What happens is that it lists all members that belong to a category, any category, not just the category selected by the user. I'm guessing that I need to use a LEFT JOIN but I'm not really familiar with all of that. Any help? Thanks! Link to comment https://forums.phpfreaks.com/topic/72995-joining-3-tables-to-get-results-in-dw/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.