Solved

Help with query - INNER JOIN SUB QUERY

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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

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

Suggested Solutions

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 …
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 …
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

929 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

12 Experts available now in Live!

Get 1:1 Help Now