order表字段:order_id,product_id查询购买产品A的订单同时会购买哪些产品SELECTprodcut_id,COUNT(*)ASnumsFROMorderLEFTJOIN(SELECTorder_idFROMorderWHEREproduct_id=100)ASorder_bONorder_b.order_id=order.order_idWHEREorder_b.order_idISNOTNULLGROUPBYproduct_idORDERBYnumsDESCoder_id,prodcut_id已做索引请问如何优化以上查询语句?
FFIVE
小怪兽爱吃肉
相关分类