小编Wil*_*mKF的帖子

如何为一列选择不同的列和另一列中的任何列?

我需要查询 SQL 数据库以查找一列的所有不同值,我需要另一列中的任意值。例如,考虑下表有两列,键和值:

key     value
===     =====
one     test
one     another
one     value
two     goes
two     here
two     also
three   example
Run Code Online (Sandbox Code Playgroud)

我希望从每个不同的键中取回一个任意选择的样本行,也许得到这三行:

key     value
===     =====
one     test
two     goes
three   example
Run Code Online (Sandbox Code Playgroud)

如何在 SQL 中制定这样的查询?

query

40
推荐指数
2
解决办法
25万
查看次数

标签 统计

query ×1