我有這樣的選擇在這裏: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