子查询优化

论坛 期权论坛 脚本     
匿名技术用户   2020-12-30 05:33   11   0
 --action1 1.297 seconds
 select cm.customerid from 
 zx_dm_customer_manage cm ,
 (
      select t.customid from 
      zx_dm_employee_customer t,
      (
                    select t.employeeid from 
                    user_employee t,
                    (select t.id FROM users t where t.loginid='2101') t_userid_A
                    where t.userid=t_userid_A.id
      ) t_employeeid_B where t.employeeid=t_employeeid_B.employeeid
 ) t_customerid_C
 where cm.customerid in t_customerid_C.customid and cm.ifsellnote=1
 
 --action2 0.032 seconds
 select cm.customerid from 
 zx_dm_customer_manage cm
 where cm.customerid in 
  (
      select t.customid from 
      zx_dm_employee_customer t,
      (
                    select t.employeeid from 
                    user_employee t,
                    (select t.id FROM users t where t.loginid='2101') t_userid_A
                    where t.userid=t_userid_A.id
      ) t_employeeid_B where t.employeeid=t_employeeid_B.employeeid
 )
 and cm.ifsellnote=1

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:7942463
帖子:1588486
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP