Solved

Joining three tables

Posted on 2011-02-23
7
342 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now