zberg007
asked on
How to Add in Another Column With the Data Filtered
Please review my prior question, which as been answered and closed:
https://www.experts-exchange.com/questions/27722365/How-to-Query-Distinct-Values-Only-Different.html
Now, I just want to add back in one more column... the original LL.Label_Text, so that I can see this value in the returned results. I tried adding it in the select statement, but I get this error: Msg 8120, Level 16, State 1, Line 1
Column 'LABEL_LANGUAGES.LABEL_TEX T' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
When I add it to the Group By clause, I get all the results returned from my table (306) rather than my filtered data.
Thanks Experts!
https://www.experts-exchange.com/questions/27722365/How-to-Query-Distinct-Values-Only-Different.html
Now, I just want to add back in one more column... the original LL.Label_Text, so that I can see this value in the returned results. I tried adding it in the select statement, but I get this error: Msg 8120, Level 16, State 1, Line 1
Column 'LABEL_LANGUAGES.LABEL_TEX
When I add it to the Group By clause, I get all the results returned from my table (306) rather than my filtered data.
Thanks Experts!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This worked great for my purposes. Thanks!
SELECT LD.Label_ID, LD.Label_Description,LL.La
FROM LABEL_DESCRIPTIONS LD
INNER JOIN LABEL_LANGUAGES LL ON LL.Label_ID = LD.Label_ID
where LL.Language_ID = 1 OR LL.Language_ID = 5
group by LD.Label_ID, LD.Label_Description,LL.La
having Count(1) = 1
order by LL.Label_ID