sql语句之三表联查,优化?
三表联查ymx_order和ymx_combination和ymx_product_info三表.这个sql语句执行需要4秒多,还有没有办法优化,求大神指点SELECTy...
三表联查ymx_order 和ymx_combination 和 ymx_product_info 三表. 这个sql语句执行需要4秒多,还有没有办法优化,求大神指点
SELECT
ypi.pi_id
FROM
( SELECT oh.home_backk AS sku FROM ymx_order AS oh
WHERE oh.home_yunstate='已采购'
GROUP BY oh.home_backk ) AS yoh
INNER JOIN ymx_combination AS ypc ON ypc.pco_skuuppdate = yoh.sku
INNER JOIN ymx_product_info AS ypi ON ypc.pi_id = ypi.pi_id
GROUP BY
ypi.pi_id 展开
SELECT
ypi.pi_id
FROM
( SELECT oh.home_backk AS sku FROM ymx_order AS oh
WHERE oh.home_yunstate='已采购'
GROUP BY oh.home_backk ) AS yoh
INNER JOIN ymx_combination AS ypc ON ypc.pco_skuuppdate = yoh.sku
INNER JOIN ymx_product_info AS ypi ON ypc.pi_id = ypi.pi_id
GROUP BY
ypi.pi_id 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询