我有两个Mysql查询:
1:
select TblC.name,
SUM(TblC.total) as Sum
from TblC
left join TblCli on TblC.id_cli = TblCli.id
group by TblCli.name asc
结果是
NAME SUM
john 1000
peter 500
Alicia 300
2:
select TblCli.name,
SUM(TblRec.total) as Pay
from TblRec
left join TblCli on TblRec.id_cli = TblCli.id
group by TblCli.name asc
结果是
NAME Pay
john 500
peter 100
有两个不同的表没有直接关系 我需要加入这两个查询并获得如下结果:
NAME SUM PAY Difference
john 1000 500 500
peter 500 100 400
Alicia 300 0 300
我该怎么做?