Tuesday, 13 August 2013

SQL Query Distinct Inner Join Issue

SQL Query Distinct Inner Join Issue

I'm having a problem with the following SQL INNER JOIN statement. I'm
probably missing something syntactically:
(SELECT DISTINCT Name from Table.Names WHERE Haircolor='Red) uniquename
INNER JOIN
(SELECT * FROM Table.Names) allnames
ON uniquenames.Name = allnames.Name;
Essentially, I'm trying to find all unique name values which also have a
corresponding Haircolor column value of "Red" and then grab all the
information associated with each unique name (for example, address, phone
number, etc).
Any ideas? Thanks in advance.

No comments:

Post a Comment