脑子抽经了,忘记怎么写了
SELECT dp,sum(fh) fh,sum(th) th FROM
(SELECT f.*,0 th FROM f
union all
SELECT t.dp,0 fh,t.th FROM t)a
GROUP BY
dp
先把发货退货的两个字段union 等到abcd的字段 然后再去left join tab1 tab2的两个发货退货字段