Having this table:
Row Pos Outdata Mismatch Other
1 10 S 0 A
2 10 S 5 A
3 10 R 0 B
4 10 R 7 B
5 20 24 0 A
6 20 24 5 B
6 20 32 10 C
How can I select all rows where Pos=10 having unique Outdata. If more than one row exists, I would like to have the row where the field Mismatch is smallest. Ie I would like to get rows 1 and 3, not 2 and 4.
In that select I would also like to do the same for all Pos=20, so the total result should be rows 1,3,5,6
(And I want to then access the "Other" field, so I cant only SELECT DISTINCT on Pos and OutData and Mismatch).
Is there a query to do this in MySQL?