This question already has answers here:
In SQL, how do I get all rows where a column's value is the lowest in the table?
(3个答案)
6年前关闭。
*如果一列中有两个或多个相同的值,如何从中获取最小值?
name   |   age
--------------
Peter  |   25
Andre  |   31
John   |   18
Lisa   |   31
Dick   |   29
Jen    |   18

我要最年轻人的名字。min(age)只返回第一个。

最佳答案

SELECT *
FROM table
WHERE age = (SELECT min(age) FROM table)

关于mysql - 如果有两个相同的值,如何在SQL中查找最小值? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15086936/

10-16 15:21