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
Solved

Help with query - INNER JOIN SUB QUERY

Posted on 2014-08-01
2
209 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
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

860 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