Hello, i did this query on Magento 2.2.6
SELECT DISTINCT
so.increment_id, so.created_at, so.customer_firstname, so.customer_email, soi.product_options
FROM
sales_order so
INNER JOIN
sales_order_item soi
ON so.increment_id = soi.order_id
WHERE
[login to view URL] = 'processing'
AND
so.customer_email NOT LIKE '%amazon%'
AND soi.product_options LIKE '%location%'
GROUP BY so.increment_id
ORDER BY so.increment_id ASC
----
but it doesnt working because in sales_order_item the order_id is not the increment_id of sales order.
I didn't find the order id in sales_order_item, but i need it for collect data indicated in the select.
Plz, magento expert, explain me how make this query
Thank you
Hi there,
I can help you with your query.
The problem could be with your join or grouping. Check the relation (primary - foreign key) columns between the two tables.
I'll have to have a look at your database schema to help you further.
Regards
Sir, I read your requirement carefully and am interested in your project.
I'm expert MySQL databases, I can correct your queries in less than hour.
Thanks for reading.