我有这样的选择在这里:MySql和子查询,它为什么这么慢?
select parent_id from sales_flat_order_status_history where status like '%whatever%' group by parent_id having count(parent_id) > 1
此查询仅运行几秒钟。现在,我想在另一个选择使用它,就像这样:
select increment_id from sales_flat_order where entity_id in(
select parent_id from sales_flat_order_status_history where status like '%whatever%' group by parent_id having count(parent_id) > 1)
这将永远运行下去,所以我试图插入的ID逐一:
select increment_id from sales_flat_order where entity_id in(329,523,756,761,763,984,1126,1400,1472,2593,3175,3594,3937,...)
这跑得快,哪里是差我怎样才能让我的第一个方法更快地工作?
谢谢!
是的,确实快得多!谢谢 – user1540714 2012-08-14 13:07:42