I'm using a Magento 2.3 instance, how could I export my orders in a CSV file by date range via SQL?
I want to have the shippingId, orderId and paymentId included in it.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityTry to use the below query and you can generate CSV from a database.
SELECT O.entity_id AS "Order ID",
P.entity_id AS "Payment ID",
S.entity_id AS "Shipment ID"
FROM sales_order O
LEFT JOIN sales_order_payment P ON (O.entity_id = P.parent_id)
LEFT JOIN sales_shipment S ON (O.entity_id = S.entity_id)
WHERE O.created_at between '2019-12-01' and '2020-11-11'
ORDER BY O.created_at