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