I
I
ImVeryStupid2020-07-10 15:45:06
MySQL
ImVeryStupid, 2020-07-10 15:45:06

How to formulate a request?

Two columns

1;21
1;45
1;23
2;34
2;23
3;52
3;52
3;13
3;26

How to keep only the smallest values ​​of the second column for each unique value of the first column?

That is

1;21
2;23
3;13

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Gordinskiy, 2020-07-10
@ImVeryStupid

SELECT 
    field1,
    MIN(field2)
FROM tableName
GROUP BY 1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question