Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一些记录,只想保留客户的最低(最小)数字:
这:
Customer | Number 1 | 2 1 | 4 2 | 1 1 | 3 2 | 2
应该通过sql转换为:
Customer | Number 1 | 2 2 | 1
使用 Sybase ADS 本地表。
您应该能够使用min()和分组customer:
min()
customer
select customer, min(number) from yourtable group by customer
请参阅带有演示的 SQL Fiddle
SELECT Customer, MIN(Number) FROM your_table GROUP BY Customer;