Here is the the right SQL
Code:SELECT [contract].[HowMutch], (SELECT sum([costs].[Value]) FROM costs WHERE costs.IDcontract_FK = contract.ID_PK GROUP BY [costs].[IDcontract_FK]) AS CostSum, (SELECT sum([foreincosts].[Value]) FROM foreincosts WHERE foreincosts.ID_Contract_FK = contract.ID_PK GROUP BY [foreincosts].[ID_Contract_FK]) AS FCostSum, (SELECT sum([service].[Value]) FROM service WHERE service.ID_Contract_FK = contract.ID_PK GROUP BY [service].[ID_Contract_FK]) AS ServSum FROM contract;




Reply With Quote