As the title says, I am running a few queries on a Magento 2 DB, but they never execute. When I run the queries on the server, the DB disk gets full and the queries don't stop loading, but when I run them locally they never execute.
The first query is:
SELECT B.value AS "BARCODE", A.sku AS "SKU", A.name AS "NAME", A.price AS "PRICE", A.created_at AS "DATE" FROM `sales_order_item` AS A INNER JOIN `catalog_product_entity_varchar` AS B WHERE A.created_at LIKE "2015-11%" OR A.created_at LIKE "2015-12%" AND B.attribute_id = 148
GROUP BY A.sku ORDER BY `DATE` ASC
Which basically displays a sales report.
The second one is:
SELECT A.value AS "MANUFACTURER", SUM(B.price) AS "TOTAL" FROM `sales_order_item' AS B INNER JOIN `catalog_product_entity_varchar` AS A WHERE A.attribute_id = 81 AND B.created_at LIKE "%%" OR B.created_at LIKE "%%"
GROUP BY A.value
Which does the same just at a manufacturer level instead of product level.
Am I doing something completely wrong or am I just missing something?
Thank in advance and have a great day.
SELECT B.value AS "BARCODE", A.sku AS "SKU", A.name AS "NAME", A.price AS "PRICE", A.created_at AS "DATE" FROM `sales_order_item` AS A left JOIN `catalog_product_entity_varchar` AS B on A.`product_id` = B.`entity_id` WHERE (A.created_at LIKE "2021-11%" OR A.created_at LIKE "2021-12%") AND B.attribute_id = 88 GROUP BY A.sku ORDER BY `DATE` ASC