I need to write a SQL query to get all countries
where we have shipped al orders.
Which table has all sales order
countries?
I am not able to find all the countries.
From this query you can get countries of shipped orders
SELECT o.increment_id, oa.country_id FROM sales_order o
INNER JOIN sales_order_address oa ON o.entity_id=oa.parent_id
INNER JOIN sales_shipment s ON o.entity_id=s.order_id
WHERE oa.address_type='shipping'
The join for sales_order_address
is to get shipping country
And the join for sales_shipment
is to get the orders which are shipped.