Solved

Help with query - INNER JOIN SUB QUERY

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

As a database administrator, you may need to audit your table(s) to determine whether the data types are optimal for your real-world data needs.  This Article is intended to be a resource for such a task. Preface The other day, I was involved …
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

777 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