I have a master table
containing 8 columns and I want to select unique
combinations of 5 columns.how can i do that in sqlserver?
EDIT:i need to retrieve all 8 columns that have 5 unique columns.
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 can also be achieved by doing:
EDIT: To retrieve all 8 columns with 5 unique, you need to decide how to aggregate those 3 columns. In other words, something like this:
In other words, if you aren’t grouping by a particular column you logically need to decide how you want to retrieve the other columns. See this MSDN reference on Aggregate Functions to find all of the possible functions that you can use for aggregation.