In Postgresql, the query is getting an error for saying that schema "purchase_order" doesn't exist.
from ((select a.item_no
from stocka a
join order_item oi
on (oi.item_no = a.item_no)
join purchase_order po
on (po.order_no = oi.order_no)
where po.location = 'LocationA'
) UNION ALL
(select b.item_no
from stockb b
join order_item oi
on (oi.item_no = b.item_no)
join purchase_order po
on (po.order_no = oi.order_no)
where po.location = 'LocationB'
))
The Union
is for the from clause
It is for some reason saying that purchase_order isn't a table, but a schema.