sql,求和小于一定值的数据行

select 

count(id),sum(Price)
from [T_AddPrice] as a
where (select sum(Price) from [T_AddPrice] as b where a.id<=b.id)<1000
--order by id

猜你喜欢

转载自www.cnblogs.com/Fooo/p/10333864.html