如何找到列 A 的值,其中列 B 的值是 B 的最小值

How to find the value of a column A where the value of column B is the min value for B

我有一个table这样的

|---------------------------|
|     A      |       B      |
|---------------------------|
|     1      |       5      |
|     2      |       7      |
|     3      |      12      |
|     4      |     100      |
|     5      |       0      |
|     6      |       2      |
|     7      |       5      |
|---------------------------|

SQL 查询或 JPQL 查询 return 是 B 具有最小值的行中 A 的值(或者最终所有行都具有相同的最小值)?

在此示例中,查询应 return 5 或在 JPA 的情况下对应于 A = 5 的行的整个实体。

select a from your_table
where b = (select min(b) from your_table)