'SQL query for customer and order- profit data

I am trying to write a query. I have 2 table in first table customer and 2018, 2019 order and profit data. In second table customer and 2020 0rder and profit data.

I want to write a query that will return all customer and their order and profit in a different format.

I have attached the screenshot of data and output.

enter image description here

sql


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source