0
它是由compcobalt通过这个线程问(用于SQL Server ):Select random rows and stop when a specific sum/total is reached选择随机行和停止在特定金额/总达到
详细信息:
我使用SQL Server 2012,我试图做这样的事情:
SELECT SUM(MILES) from tblName WHERE
mDate > = '03/01/2012' and
mDate <= '03/31/2012'
-- and...
/*
now I want to add here do until the SUM of Miles
is equal to or greater then '3250' and get the
results rows randomly
*/
换句话说,我想从已经指定由和日期表中选择任意行和停止时的里程总和达到或超过数:3250
但我的问题是如何与SQL Server做?谢谢
因此,没有纯粹的sql查询做到这一点,对吧? –