问题 I have the following table (SQL Server 2012): DID - cust id GID - order id AMT - order amt Gf_Date - order date SC - order reversal amount I'm trying to calculate a running count of orders and a running total of sales by customer so that I can assign a flag to the point in time where a customer achieved cumulative sales of $1,000. As a first step, I've run this query: Select [DID] , [AMT] , [Gf_Date] , COUNT([GID]) OVER (PARTITION BY [DID] ORDER BY [Gf_Date]) [RunningGift_Count] , SUM([AMT])