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?
4 Months Ago
Related Article:Self-join to remove duplicates
is a MS SQL discussion thread by cheapterp that has 5 replies, was last updated 11 months ago and has been tagged with the keywords: duplicate, self-join.
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