|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL INNER JOIN question
Hello,
I’m having a problem getting this SQL statement correct, so any assistance would be great. I have 3 tables I’m trying to search, here is the relevant info: users first_name last_name presentation userID group_members presentationID userID These are the statements I have so far: SELECT DISTINCT presentations.ID, presentations.title, presentations.room, presentations.scheduled_time, presentations.main_mentor, presentations.additional_mentor_1, presentations.additional_mentor_2, users.first_name, users.last_name FROM presentations, group_members INNER JOIN users ON presentations.userID=users.ID This one works fine for pulling everything, except it does not search in the group_members table to find matches. So I tried this one: SELECT DISTINCT presentations.ID, presentations.title, presentations.room, presentations.scheduled_time, presentations.main_mentor, presentations.additional_mentor_1, presentations.additional_mentor_2, users.first_name, users.last_name users INNER JOIN presentations ON users.ID=presentations.userID) INNER JOIN group_members ON users.ID=group_members.userID This one searches the group_members but then only pulls back the presentations that have group members in it, not both. I tried several other INNER JOIN, LEFT JOINS and others I found searching here but nothing seemed to pull them correctly. Any suggestions would be great, and thanks any help provided. |
|
#2
|
||||
|
||||
|
Okay, you've explained what the sql statements do and what they return, but you didn't specify what you wanted returned.
|
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SQL INNER JOIN question |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|