1,105,226 Community Members

JOIN ON command

Member Avatar
bellachara
Newbie Poster
2 posts since Jan 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 
SELECT DISTINCT course.course_no, description
    FROM course, section
    WHERE location = 'L210'
    ORDER BY course_no

Here is the problem: Give me a list of courses (by course_no and description) that are taught in room L210

But now find out I need to use the JOIN...ON... syntax
Need help redoing that with the above statement I started...Any takers?

Member Avatar
adam_k
Veteran Poster
1,056 posts since Jun 2011
Reputation Points: 239 [?]
Q&As Helped to Solve: 212 [?]
Skill Endorsements: 17 [?]
 
0
 

It would help if we knew the structure of the tables (or the key they share).
Anyway, your syntax will create a cartesian product, as you haven't set any criteria for the join you are performing (you are performing a join, but with the old syntax and without the on.. part)

So, you would right it as:

select distinct course.course_no, description 
from course inner /*(or left or right or cross or full) */ join section 
on course.field = section.field --you need to change the field appropriately 
where location = 'L210' 
order by course_no 
Member Avatar
bellachara
Newbie Poster
2 posts since Jan 2013
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

thank you adam! appreciate your reply and help

You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: