我使用的是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
謝謝!!!!! :) – compcobalt 2013-03-07 18:36:39