有没有办法优化这个查询:
select
orders_id,
orders_products_id,
sum(CASE products_options_id WHEN 1 THEN products_options_values_id ELSE 0 END) as color,
sum(CASE products_options_id WHEN 2 THEN products_options_values_id ELSE 0 END) as talle
from
orders_products_attributes
group by
orders_products_id
这是解释输出:
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE orders_products_attributes ALL NULL NULL NULL NULL 69006 Using temporary; Using filesort
谢谢!
卢西亚诺