ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 效率神器,一键搞定繁琐工作
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
让更多数据处理,一键完成 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
查看: 1182|回复: 0

[求助] 为啥代码A包含B,但B的运行速度却慢于A呢?

[复制链接]

TA的精华主题

TA的得分主题

发表于 2012-8-30 14:29 | 显示全部楼层 |阅读模式
本帖最后由 zjszjs27 于 2012-8-30 14:32 编辑
  1. SELECT K.HBSC_NAME, K.BTSID, K.BTSNAME, K.基站PD数量, K.需空隙时隙数, L.IDLETS_NUM AS 已配空隙时隙数, L.E1_NUM AS 传输条数, IIF(K.需空隙时隙数-L.IDLETS_NUM<0,0,K.需空隙时隙数-L.IDLETS_NUM) AS 需增加空隙时隙数, K.TRX_NUM AS 载频数, K.BTS_PTNUM AS PD和TCH信道数, IIF((K.BTS_PTNUM+K.需空隙时隙数+IIF( (K.TRX_NUM+1)/K.E1_MODE-INT((K.TRX_NUM+1)/K.E1_MODE)>0,(K.TRX_NUM+2),(K.TRX_NUM+1) )*(4/K.E1_MODE))<=L.E1_NUM*124,0,ROUND(((K.BTS_PTNUM+K.需空隙时隙数+IIF( (K.TRX_NUM+1)/K.E1_MODE-INT((K.TRX_NUM+1)/K.E1_MODE)>0,(K.TRX_NUM+2),(K.TRX_NUM+1) ))*(4/K.E1_MODE)-L.E1_NUM*124)/124+0.4999)) AS 需增加E1数
  2. FROM (SELECT J.HBSC_NAME, J.BTSID, ADD_BTS.BTSNAME, J.基站PD数量, J.基站PD数量*3 AS 需空隙时隙数, J.BTS_PTNUM, J.TRX_NUM, MID(ADD_BTS.MPMODE,INSTR(ADD_BTS.MPMODE,"_")-1,1) AS E1_MODE FROM ADD_BTS INNER JOIN (SELECT H.HBSC_NAME, H.BTSID, SUM(G.PD最大数量) AS 基站PD数量, SUM(G.PT_CHAN_NUM) AS BTS_PTNUM, SUM(G.TRX_NUM) AS TRX_NUM FROM ADD_CELLBIND2BTS AS H INNER JOIN (SELECT F.HBSC_NAME, F.CELLID, INT(E.MAXPDCHRATE*(F.TCHFR数量+F.PDTCH数量)/100) AS PD最大数量, F.PT_CHAN_NUM, F.TRX_NUM FROM SET_GCELLPSCHM AS E INNER JOIN (SELECT A.HBSC_NAME, A.CELLID, SUM( IIF(B.CHTYPE NOT IN ( "BCH","BCCH","SDCCH") , 1 , 0 )) AS PT_CHAN_NUM, SUM( IIF(B.CHTYPE = 'TCHFR' , 1 , 0 )) AS TCHFR数量, SUM(IIF(B.CHTYPE = 'PDTCH' , 1 , 0 )) AS PDTCH数量, (COUNT(B.CHTYPE) +2)/8 AS TRX_NUM FROM ADD_GTRX AS A INNER JOIN SET_GTRXCHAN AS B ON (A.TRXID = B.TRXID) AND (A.HBSC_NAME = B.HBSC_NAME) GROUP BY A.HBSC_NAME, A.CELLID)  AS F ON (F.CELLID=E.CELLID) AND (F.HBSC_NAME=E.HBSC_NAME))  AS G ON (G.CELLID=H.CELLID) AND (G.HBSC_NAME=H.HBSC_NAME) GROUP BY H.HBSC_NAME, H.BTSID)  AS J ON (J.BTSID=ADD_BTS.BTSID) AND (J.HBSC_NAME=ADD_BTS.HBSC_NAME))  AS K INNER JOIN (SELECT R.HBSC_NAME, R.BTSID, R.IDLETS_NUM, R.GUIZU_NUM, S.E1_NUM FROM (SELECT Q.HBSC_NAME, Q.BTSID, SUM(Q.TS_NUM) AS IDLETS_NUM, COUNT(Q.CGN) AS GUIZU_NUM FROM (SELECT SET_BTSIDLETS.HBSC_NAME, SET_BTSIDLETS.BTSID, SET_BTSIDLETS.CGN, MAX(SET_BTSIDLETS.TSCOUNT) AS TS_NUM FROM SET_BTSIDLETS GROUP BY SET_BTSIDLETS.HBSC_NAME, SET_BTSIDLETS.BTSID, SET_BTSIDLETS.CGN)  AS Q GROUP BY Q.HBSC_NAME, Q.BTSID)  AS R INNER JOIN (SELECT ADD_BTSCONNECT.HBSC_NAME, ADD_BTSCONNECT.BTSID, Count(ADD_BTSCONNECT.BTSID) AS E1_NUM FROM ADD_BTSCONNECT GROUP BY ADD_BTSCONNECT.HBSC_NAME, ADD_BTSCONNECT.BTSID)  AS S ON (R.BTSID=S.BTSID) AND (R.HBSC_NAME=S.HBSC_NAME))  AS L ON (K.HBSC_NAME=L.HBSC_NAME) AND (K.BTSID=L.BTSID)
  3. ORDER BY K.HBSC_NAME, K.BTSNAME;
复制代码
上面是代码A
下面是代码B

  1. SELECT A2.HBSC_NAME, ADD_GTRX.CELLID, A2.BTSID, A2.CN, A2.TRXTP, COUNT(A2.TRXID) AS TRXNUM, SUM(A2.PTNUMA1) AS PTNUM
  2. FROM (SELECT ADD_TRXBIND2PHYBRD.HBSC_NAME, ADD_TRXBIND2PHYBRD.BTSID, ADD_TRXBIND2PHYBRD.CN, ADD_TRXBIND2PHYBRD.TRXTP, A1.TRXID, A1.PTNUMA1 FROM (SELECT SET_GTRXCHAN.HBSC_NAME, SET_GTRXCHAN.TRXID, SUM(IIF(SET_GTRXCHAN.CHTYPE IN ("PDTCH","TCHFR"),1,0)) AS PTNUMA1 FROM SET_GTRXCHAN GROUP BY SET_GTRXCHAN.HBSC_NAME, SET_GTRXCHAN.TRXID)  AS A1 INNER JOIN ADD_TRXBIND2PHYBRD ON (A1.TRXID=ADD_TRXBIND2PHYBRD.TRXID) AND (A1.HBSC_NAME=ADD_TRXBIND2PHYBRD.HBSC_NAME))  AS A2 INNER JOIN ADD_GTRX ON (A2.HBSC_NAME=ADD_GTRX.HBSC_NAME) AND (A2.TRXID=ADD_GTRX.TRXID)
  3. GROUP BY A2.HBSC_NAME, ADD_GTRX.CELLID, A2.BTSID, A2.CN, A2.TRXTP;
复制代码

代码A应该是包含代码B的,可是代码B的运行速度远低于代码A的运行速度。请问这是什么原因啊???
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2025-1-8 13:10 , Processed in 0.016559 second(s), 9 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表