SELECT
CustomerID
, SalesOrderID
, CAST(OrderDate AS DATE) AS OrderDate
, TotalDue
, LAST_VALUE(TotalDue) OVER ( PARTITION BY CustomerID ORDER BY SalesOrderID ) AS TD
FROM
Sales.SalesOrderHeader
ORDER BY
CustomerID
Precious Lite 2022 | All Rights Reserved. Precious Lite theme by Flythemes