?
Solved

Joining three tables

Posted on 2011-02-23
7
Medium Priority
?
365 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 37

Accepted Solution

by:
Neil Russell earned 1000 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 1000 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

649 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