I have a table with a primary key ID column A, and several other data columns. I need to build a query that selects this column A when a unique combination of columns B & C, has more than 1 distinct value in column D. Thanks!
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This should do the trick:
The inside join selects the rows (columnB and columnC) that have more that one (distinct) columnD, when grouping all rows from tablename by columnB and columnC.
The outer join will then select the ids (columnA) that have the columnB and columnC resulting from the inside join.