我有以下表格
TA-ID quantity
10139 1
10139 3
10139 4
10140 5
10140 1
10141 6
10141 4
10141 3
我想要的输出是
TA-ID quantity
10139 1
10140 1
10141 3
请帮助构建查询并解释
答案 0 :(得分:0)
使用group by获取唯一ID和MIN()以获得该列的最低值
SELECT TA-ID, MIN(quantity)
FROM 'table'
GROUP BY TA-ID
答案 1 :(得分:0)
SELECT TA-ID, MIN(quantity)Quantity FROM Tbl1 GROUP BY TA-ID