Solved

Help with query - INNER JOIN SUB QUERY

Posted on 2014-08-01
2
210 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
[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
2 Comments
 
LVL 21

Assisted Solution

by:Randy Poole
Randy Poole earned 195 total points
ID: 40234090
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 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 195 total points
ID: 40234093
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

749 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