【发布时间】:2013-08-28 09:31:47
【问题描述】:
compcobalt (for SQL Server 2012) 通过这个线程询问了它: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 2000 做到这一点?谢谢
【问题讨论】:
标签: sql sql-server-2000