Using the same pattern, utilize a subquery to find the average sale price over both order_items and order_items_historic tables.
My code is:
select id, avg(sale_price) from (
select id, sale_price from order_items
select id, sale_price from order_items_historic) as a;
the error is:
Select the average sale price avg(a.sale_price) for each item id for both the order_items and order_items_historic tables.
I am confused about what’s wrong. Can anyone help me with that?