我不是 sql 专家,我需要以下查询的帮助。它的优化很差,执行时间太长。是否可以替换IN()
为JOIN()
以加快查询速度?怎么做?
SELECT *
FROM shop_orders
WHERE id IN (SELECT orders_id
FROM shop_orders_data
WHERE closed = '1' /*AND backorder='0'*/)
AND id IN (SELECT orders_id
FROM shop_orders_products
WHERE products_id IN (SELECT id
FROM shop_products
WHERE artno = '120000'
OR name LIKE '%120000%'))
ORDER BY created DESC