Solved

Joining three tables

Posted on 2011-02-23
7
344 Views
Last Modified: 2012-08-13
I need help joining three tables with the JOIN USING syntax. Here is what I have could you please tell me what I'm overlooking?

Select song_id, cd_number, title, comments
From d_play_list_items  JOIN d_cds
USING (cd_number)
JOIN d_track_listings

The tables d_play_list_items & d_track_listings share the song_id column.
The tables d_track_listings & d_cds share the cd_number column.

When I submit this query it tells me that it is missing keyword
0
Comment
Question by:dc0819
7 Comments
 
LVL 37

Accepted Solution

by:
Neil Russell earned 250 total points
ID: 34963711
Try

Select song_id, cd_number, title, comments
From d_play_list_items  
JOIN d_track_listings
USING song_id
JOIN d_cds
USING (cd_number)


0
 

Author Comment

by:dc0819
ID: 34963757
Still showing missing keyword
0
 
LVL 11

Assisted Solution

by:Akenathon
Akenathon earned 250 total points
ID: 34964092
Select song_id, cd_number, title, comments
From d_play_list_items  
JOIN d_track_listings USING (song_id)
JOIN d_cds USING (cd_number)

You need parentheses around the USING fields
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 37

Expert Comment

by:Neil Russell
ID: 34964556
Oops I missed the brackets on the one line, your right. thank you.
0
 

Author Comment

by:dc0819
ID: 34970481
That worked - I overlooked the brackets as well.

Thanks
0
 

Expert Comment

by:South Mod
ID: 35015585
I've reopened your question in order to award points more equitably.

Since both Experts provided a substantial portion of this solution, I've split the points evenly between them. In cases like this, where one Expert (Akenathon) corrects the posting of another, it's customary to accept both comments. In fact, the second Expert (in this case, Akenatho) really should recognize that they are mading edits to the suggestion of an earlier Expert by posting something like this:

"Neilsr's answer is almost correct, except you must include parentheses around the USING fields"

Select song_id, cd_number, title, comments
From d_play_list_items  
JOIN d_track_listings USING (song_id)
JOIN d_cds USING (cd_number) "

This recognizes the earlier work of the other Experts while still providing assistance to the author.

SouthMod
EE Moderator
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linking a DMV to a database id/sql text in SQL server 2008 8 53
Help Extract Specific in SQL 8 34
Common Records between Sub Queries 4 25
sql server insert 12 30
Introduction Hopefully the following mnemonic and, ultimately, the acronym it represents is common place to all those reading: Please Excuse My Dear Aunt Sally (PEMDAS). Briefly, though, PEMDAS is used to signify the order of operations (http://en.…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question