to be more clear I have these kind of data.
Query 1) Data from 2016
Item Price Quantity
Shoe 20 10
Shoe 30
Try use it, It includes GROUP BY
the items and the prices.
SELECT Item,
Price,
SUM(Quantity2016),
SUM(Quantity2017),
...
FROM
(
--query 1:
SELECT Item,
Price,
Quantity AS Quantity2016,
NULL AS Quantity2017
NULL AS Quantity2018
NULL AS Quantity2019
FROM 2016
UNION ALL
--query 2:
SELECT Item,
Price,
NULL AS Quantity2016,
Quantity AS Quantity2017
NULL AS Quantity2018
NULL AS Quantity2019
FROM 2017
UNION ALL
--query 3:
SELECT Item,
Price,
NULL AS Quantity2016,
NULL AS Quantity2017
Quantity AS Quantity2018
NULL AS Quantity2019
FROM 2018
UNION ALL
...
)A
GROUP BY Item, Price