以下是我的两张桌子;我想要第三个表中所示的结果。我如何在 MySQL 中做到这一点(假设 FULL JOIN)?
table_sales
product_id quantity date
c001 20 2013-09-03
t008 30 2013-09-01
t008 20 2013-09-03
c001 90 2013-09-09
table_returns
product_id quantity date
t008 40 2013-09-08
t008 30 2013-09-01
c001 10 2013-09-03
我想得到如下结果:
product_id sale_qty return_qty date
c001 20 10 2013-09-03
c001 90 - 2013-09-09
t008 30 30 2013-09-01
t008 20 - 2013-09-01
t008 - 40 2013-09-08