Magento 2 Order SQL Enhancement

Job ID: 39958865

Budget: $10 – $30 USD

I already have a working SQL statement that pulls every order from my Magento 2 store together with the customer’s delivery address and phone number. I now need it refined so that it also returns the order status.

What I need:

• Version 1 – keeps my current logic but adds the status column and therefore shows every status at once.
• Version 2 – identical to Version 1 yet includes a clear placeholder where I can manually type a single status value (for example “on hold”, “processing”, “complete”) to filter the results.

Both queries must run on the standard Magento 2 table structure in MySQL / MariaDB without changing my existing joins. Please comment the code so I can see which part was added and where to enter a status for Version 2.

Deliverables
1. An SQL file (or two snippets) containing both versions, cleanly commented.
2. A short read-me explaining any table aliases you used and how to switch the status filter.

That’s it—no other changes to the data model are required.