-
select prod_name,count(order_num) as orders
-
from Products A
-
left join OrderItems B
-
on A.prod_id=B.prod_id
-
group by prod_name
-
union
-
select prod_name,count(order_num) as orders
-
from Products C
-
left join OrderItems D
-
on C.prod_id=D.prod_id
-
where C.prod_id is null
-
group by prod_name
-
order by prod_name