I have a scenario where I have duplicate data in a file – where the ‘unique’ identifiers equal the same.
I am trying to identify which of the decimal values in the ‘Outcome1’ field is the MIN value, which will then give me results which are not duplicated.
I have tried to use MIN, but it seems to not work as I have to group by the ‘Outcome1’ field.
The current table looks like this:
| ID | Outcome1 | Outcome2 |
|---|---|---|
| 1 | 186.5098 | 133.8825 |
| 1 | 186.5093 | 133.8820 |
The expected result is as follows:
| ID | Outcome1 | Outcome2 |
|---|---|---|
| 1 | 186.5093 | 133.8820 |
I would really appreciate any assistance.
>Solution :
Assuming you want the lowest value from both Outcome1 and Outcome2 you would do this with a basic MIN.
select ID
, Outcome1 = MIN(Outcome1)
, Outcome2 = MIN(Outcome2)
from YourTable
group by ID