以下は私の 2 つのテーブルです。3 番目の表に示すような結果が必要です。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