我有一些记录,只想保留客户的最低(最小)数字:
此:
Customer | Number
1 | 2
1 | 4
2 | 1
1 | 3
2 | 2
应该通过sql转换为:
Customer | Number
1 | 2
2 | 1
使用Sybase ADS本地表。
答案 0 :(得分:2)
您应该能够使用min()
并按customer
select customer, min(number)
from yourtable
group by customer
答案 1 :(得分:1)
SELECT Customer, MIN(Number)
FROM your_table
GROUP BY Customer;