Monday, July 29, 2019

cách lấy lũy kế SQL Server

select r.RequestId, r.TransRef, sum(r.TransAmount) over (partition by r.TransRef order by r.RequestId) as LuyKeTienTheoThoiGianCua1GD
from Core_Request r
where r.CreatedDate > '2019-07-29' and r.CreatedDate < '2019-07-30'
and r.Status = 1 and r.TransRef in ('2989087290719093311611', '8820967290719072119900')

No comments:
Write comments