Adding computed column in SQL

Viewed 3101

How to add computed column that calculates the sum of selected column.

this is what i've done but has an error..

ALTER TABLE dbo.tblEM_Reimbursement
ADD [Amount] AS (SELECT SUM(Total) FROM dbo.tblEM_ReimbursementEntry WHERE ReimbursementID = ReimbursementID)

it says

Msg 1046, Level 15, State 1, Line 2
Subqueries are not allowed in this context. Only scalar expressions are allowed.

Thanks in advance

2 Answers
Related