看看这个可以吗
--测试数据
if not object_id(N'Tempdb..#T') is null
drop table #T
Go
Create table #T([CustomerCode] NVARCHAR(100),[SlipDate] NVARCHAR(100),[UnitPrice] decimal(18,8),[Number] int)
Insert #T
select '661001','2017-06-23',2000.00,1 union all
select '661001','2017-06-02',2300.00,2 union all
select '661001','2017-05-31',2100.00,3 union all
select '661001','2017-05-26',2300.00,4 union all
select '661001','2017-05-22',2300.00,5 union all
select '661001','2017-05-13',2300.00,6 union all
select '661001','2017-05-13',2300.00,7 union all
select '661001','2017-05-12',2300.00,8 union all
select '661001','2017-02-07',2800.00,9 union all
select '661001','2017-02-04',2800.00,10 union all
select '661001','2016-12-22',2500.00,11 union all
select '661001','2016-12-10',2800.00,12 union all
select '661001','2016-12-06',2500.00,13 union all
select '661001','2016-11-15',2500.00,14 union all
select '661001','2016-08-22',2000.00,15
Go
--测试数据结束
;WITH cte AS (
Select *,Number-ROW_NUMBER()OVER(PARTITION BY UnitPrice ORDER BY [UnitPrice]) AS rn from #T
)
SELECT *
FROM #T
WHERE Number IN ( SELECT MIN(Number) AS Number
FROM cte
GROUP BY rn )