My query looks like this:
SELECT Avg(Income) FROM
(SELECT Customer.InnerID, Customer.Type, Sum(Insurance_Season.Cost) as Income
FROM Customer, Insured_Customer, Insurance_Season, Insurance_Policy
WHERE Customer.InnerID = Insured_Customer.InnerID
AND Insured_Customer.PolicyID = Insurance_Policy.PolicyID
AND Insured_Customer.Role = 'PH'
AND Insurance_Policy.PolicyID = Insurance_Season.PolicyID
AND Insurance_Season.Begin_date > '1/1/2004'
GROUP BY Customer.InnerID, Customer.Type)
and all I get is "Incorrect syntax near ')'."
Is this not possible in SQL Server or what am I missing? I have tried simpler versions, I can't even get
SELECT Customer.InnerID FROM (Select Customer.InnerID FROM Customer)
to work.