Hi @neilsja ,
Welcome to Microsoft Q&A!
Please also refer below:
CREATE TABLE mytable(EmployeeID VARCHAR(10), AccountCode INT, Value decimal(5,2));
INSERT INTO mytable VALUES
('EMP1', '1234', 50.00 ),
('EMP1', '3456', 75),
('EMP2', '2345', 100.30),
('EMP2', '5675', 54.99 );
select * from mytable
union
select EmployeeID,9999,-1* SUM(VALUE) from mytable
group by EmployeeID
Output:
EmployeeID AccountCode Value
EMP1 1234 50.00
EMP1 3456 75.00
EMP1 9999 -125.00
EMP2 2345 100.30
EMP2 5675 54.99
EMP2 9999 -155.29
Best regards,
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.