A shortened query:
select t.Docket, t.TranType,CAST(ROUND(t.Net, 2) AS decimal(18,2)) as Net1,
CASE
WHEN t.TranType = 'SRT' THEN CAST(ROUND(t.Net, 2) AS decimal(18,2)) * -1
WHEN t.TranType = 'DIV' THEN t.net * 0
ELSE CAST(ROUND(t.Net, 2) AS decimal(18,2))
END AS Net2
from trans t
But when I want to add:
SUM (CASE
WHEN t.TranType = 'SRT' THEN CAST(ROUND(t.Net, 2) AS decimal(18,2)) * -1
WHEN t.TranType = 'DIV' THEN t.net * 0
ELSE CAST(ROUND(t.Net, 2) AS decimal(18,2))
END AS Net3) OVER () AS Total
I get error: Incorrect syntax near 'SUM'. I just want a total amount adding up everything in Net2
