I have this query table,
CREATE TABLE BASE_Purchase
(
PurchaseId BIGINT,
PurchaseDate DATE NOT NULL,
SupplierName VARCHAR(255) NOT NULL,
Amount MONEY NOT NULL,
Outstanding MONEY NULL
PRIMARY KEY(PurchaseId)
)
I have the following result set from the table,
Above image result query ↑
SELECT PurchaseId, PurchaseDate, SupplierName, Amount, Outstanding
FROM BASE_Purchase
ORDER BY SupplierName, PurchaseId
I need the above should be result as follow,
After retrieved the above result and i want to get the SUM of each outstanding
PurchaseDate
for eachSupplierName
from yourResults
? Your tags indicate both SQL2008 and SQL2014. Does the solution have to run on both?purchasedate
?