我如何根据来自另一列的不同值从一列中获取值?

How I fetch values from one column based on distinct values from other column?

我在 table 中有两列,我希望查询根据第二列的不同值获取第一列的值。因为,第一列和第二列有多种组合,我想从每个组合中获得第一个匹配项。

数据集:

First Column Second Column
A abc
B abc
C abc
D abc
F abc
G abc
H qwe
I qwe
J jkl
K jkl
L jkl
M uio
N uio

异常输出:

First Column Second Column
A abc
H qwe
J jkl
M uio

只需使用 MIN()GROUP BY

SELECT min(`First Column`) AS `First Column`, `Second Column`
FROM yourTable
GROUP BY `Second Column`

DEMO