我需要帮助
我有如下三个表:
customers [ CID , name , address , phone ]
contracts [ ID , CID , TotalPrice , ]
Payment [ ID , CID , pay ]
我想获取客户的姓名、他的电话号码和 sum(contracts .TotalPrice) - sum(Payment.pay) 的值作为 Remaning
但我很难做到这一点
我用的是microsoft access 2007
我用这个说法
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 ";