Friday, March 6, 2015

finding the sum of cumulative as per daywise

You can use apply operator for this


it will look like this



SELECT t.*,
t.TotalEstimated - Total AS Remaining
FROM table t
CROSS APPLY (
SELECT SUM([ResourceEstimatedhrsperday]) AS total
FROM table
WHERE EMployee = t.Employee
AND [WorkDate] <= t.[WorkDate]
)t1

assuming ResourceEstimatedhrsperday is in proper numerical format


Also see


http://ift.tt/1nhzL3C




Please Mark This As Answer if it solved your issue

Please Vote This As Helpful if it helps to solve your issue

Visakh

----------------------------

My Wiki User Page

My MSDN Page

My Personal Blog

My Facebook Page




No comments:

Post a Comment