Hi I want to sum up the market value for 2 columns in a table . i want to sum up where both [Security Type] = 'Ordinary Shares' and [Security Type]='N/A' and then update that figure back into the market value field where [Security Type] = 'Ordinary Shares'
my query is a s follows but it doesnt sum up the values correctly
[code]
UPDATE m
SET m.MarketValue = f.MarketValue
FROM dbo.NTAISOIHoldingsTable m
INNER JOIN
(
SELECT [Legal Entity ID],Family,[Security Type], SUM([As at 30/06/2016]) MarketValue, SUM(Quantity) Quantity
FROM dbo.NTAISOIHoldingsTable
WHERE [Security Type] = 'Ordinary Shares' or [Security Type]='N/A'
GROUP BY [Legal Entity ID], Family,[Security Type]
) f ON m.[Security Type] = 'Ordinary Shares'
[\code]
any one any ideas where i am going wrong