Solved

Help with query - INNER JOIN SUB QUERY

Posted on 2014-08-01
2
206 Views
Last Modified: 2014-08-01
How do you JOIN on as sub query. can you please tell me what's wrong with this?


SELECT *, ASSIGNMENTS.COMMENTS  FROM  NOTES N
 INNER JOIN error_codes E ON N.error_code = E.error_code
 INNER JOIN  (SELECT *   FROM Assignments  WHERE COMMENTS = 'NONE' )  Assignments  ON  N.TITLE ID = Assignments.TITLEID
0
Comment
Question by:JElster
2 Comments
 
LVL 21

Assisted Solution

by:Randy Poole
Randy Poole earned 195 total points
Comment Utility
Is this what you are trying to do?
SELECT *, A.COMMENTS  FROM  NOTES N
 INNER JOIN error_codes E ON N.error_code = E.error_code 
 INNER JOIN  Assignments A  ON  N.TITLE ID = A.TITLEID and  a.COMMENTS='NONE'

Open in new window

0
 
LVL 24

Accepted Solution

by:
Tomas Helgi Johannsson earned 195 total points
Comment Utility
Hi!

This query can be written like this
SELECT N.*,E.*, A.COMMENTS  
FROM  NOTES N,error_codes E, Assignments A
where N.error_code = E.error_code
and N.TITLE ID = A.TITLEID 
and A.COMMENTS = 'NONE'

Open in new window


I find it easier to read it like this. ;)

Regards,
    Tomas Helgi
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

A lot of articles have been written on splitting mysqldump and grabbing the required tables. A long while back, when Shlomi (http://code.openark.org/blog/mysql/on-restoring-a-single-table-from-mysqldump) had suggested a “sed” way, I actually shell …
Creating and Managing Databases with phpMyAdmin in cPanel.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
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…

762 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

8 Experts available now in Live!

Get 1:1 Help Now