Q:

How do you Add a computed column to a table that requires a join statement?

I cant figure out my syntax issue.  I am trying to ADD a computed column to an orders table. In order to do that I need to join 2 tables (Orders and Product).
ALTER TABLE tblOrder_Product
ADD [TotalCost] money 
AS (SELECT (([tbop].[Quantity])*([P].[ProductPrice]) as TotalCost)
FROM tblOrder_Product tbop INNER JOIN Product P ON tbop.ProductID = P.ProductID
GROUP BY TotalCost)

A:

You can only add a computed column based on values in that table. You can create your own logical computed column if you want to create triggers to manage the value and in the trigger code you can reference the other table, but triggers are not generally recommended.

