使用
union all和
group by:
SELECt Date, Product, SUM(Inbound) as Inbound, SUM(Outbound) as OutboundFROM ((SELECt Inbound_Date As Date, Product, SUM(Quantity) as Inbound, 0 as Outbound FROM Inbound GROUP BY 1,2 ) UNIOn ALL (SELECt Outbound_Date, Product, 0 as Inbound, COUNT(*) as Outbound FROM Outbound GROUP BY 1,2 ) ) ioGROUP BY Date, Product;



