select 订单表.订单号,订单金额,已收合计 from ({订单表} inner join (select 订单号,sum(单价*数量) as '订单金额' from {订单明细表} where 订单号 = 'xxxx' group by 订单号) as a on {订单表}.订单号 = a.订单号) inner join (select 订单号,sum(收款金额)as '已收合计' from {收款明细表} where 订单号 = 'xxxx' group by 订单号) as b on {订单表}.订单号 = b.订单号 where {订单表}.订单号 = 'xxxx'