Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Select MIN decimal value

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading