I need help
I have three tables as below :
customers [ CID , name , address , phone ]
contracts [ ID , CID , TotalPrice , ]
Payment [ ID , CID , pay ]
I want to get the name of customer , his phone number and the value of sum( contracts .TotalPrice ) - sum(Payment.pay) as Remaning
but i have trouble to do this
I use microsoft access 2007
I use this statment
select customers.name , customers.phone , customers.address, (sum( contracts .TotalPrice ) - sum(Payment.pay)) as Remaning from customers inner join contracts on customers.CID=contracts.CID inner join Payment on contracts.CID=Payment.CID ";