如何将此访问代码写入sqlite代码

时间:2017-05-20 22:06:43

标签: database sqlite access

选择Person.Person_id,Person.name,Person.last_name,(从债务中选择sum(debt.paye),其中debt.person_id = Person.Person_id)AS sum_pay,(从信用债务中选择总和(debt.not_paye)) .person_id = Person.Person_id)AS sum_not_pay, [sum_pay] - [sum_non_pay] AS def 来自人;

1 个答案:

答案 0 :(得分:-1)

select Person.Person_id, Person.name, Person.last_name,sum_pay,sum_non_pay, sum_pay-sum_non_pay as def 
from 
(
SELECT Person.Person_id, Person.name, Person.last_name, ( select sum(credit.paye) from credit where credit.person_id= Person.Person_id) AS sum_pay, ( select sum(credit.non_paye) from credit where credit.person_id= Person.Person_id) AS sum_non_pay
from person
)