200金币
SELECT A.客户名称,A.樘数,A.金额,B.发货总金额,C.应收金额 FROM
(select 客户名称,sum(樘数) as 樘数, sum(金额) as 金额 from "订单详情"
where 订单状态="确认"
group by 客户名称) as A
left JOIN (select 客户名称, sum(发货总金额) as 发货总金额 from "发货单详情表" group by 客户名称) As B
ON A.客户名称 = B.客户名称
left JOIN (select 付款方, sum(应收金额) as 应收金额 from "收入账详情表" group by 付款方) As C
ON A.客户名称 = C.付款方
想加入“订单详情”的年月份
|
|