我寫了一個SQL查詢,但其花費過多時間從table.Around取得成果15000項有沒有在我的table.My查詢和表結構如下..查詢花太長時間執行
SELECT sp1.sku
FROM `service_prices` AS sp1
WHERE attribute_id = 8 AND
attribute_value = '100000' AND
service_id = 2 AND
sp1.sku IN
(
SELECT sp2.sku
FROM `service_prices` AS sp2
WHERE attribute_id = 9 AND
attribute_value = '2' AND
service_id = 2 AND
sp2.sku IN
(
SELECT sp3.sku
FROM `service_prices` AS sp3
WHERE attribute_id = 10 AND
attribute_value = 'Haryana' AND
service_id = 2
)
)
任何幫助將不勝感激。
請在代碼中插入新行以方便閱讀。 – msagala25