我在这里有这个选择:
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,...)
这运行得很快,区别在哪里,我怎样才能让我的第一种方法更快地工作?
谢谢!