0

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.

1 Answer 1

2

Try 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.