We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,534 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

JOIN ON command

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?

2
Contributors
2
Replies
1 Hour
Discussion Span
4 Months Ago
Last Updated
3
Views
bellachara
Newbie Poster
2 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 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 
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11

thank you adam! appreciate your reply and help

bellachara
Newbie Poster
2 posts since Jan 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.0573 seconds using 2.64MB