I have a query which returns a number of ints and varchars.
I want the result Distinct but by only one of the ints.
SELECT DISTINCT
t.TaskID ,
td.[TestSteps]
FROM SOX_Task t
snip
Is there a simple way to do this?
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:
…will return a list of unique taskid values – there will not be any duplicates.
If you want to return a specific value, you need to specify it in the WHERE clause:
That will return all the rows with the specific
taskidvalue. If you want a distict list of the values associated with the taskid value:GROUP BYis another means of getting distinct/unique values, and it’s my preference to use, but in order to useGROUP BYwe need to know the columns in the table and what grouping you want.