Solved

Joining three tables

Posted on 2011-02-23
7
347 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 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
Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

 
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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
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 video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.
Suggested Courses

739 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