我正试图通过以下方式选择所有订单:
我当前的查询如下所示:
SELECT o.*
FROM ( SELECT o2.orders_id
FROM `zen_orders` o2
GROUP BY delivery_postcode, delivery_street_address
HAVING COUNT(o2.orders_id) > 1
) AS o3
LEFT JOIN zen_orders AS o ON (o.orders_id = o3.orders_id)
ORDER BY delivery_street_address
查询非常慢,我想知道我做错了什么,我应该如何修复它。
编辑:按要求添加索引,速度要快得多。还跑了“解释”: