|
本帖最后由 zjszjs27 于 2012-8-30 14:32 编辑
- 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数
- 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)
- ORDER BY K.HBSC_NAME, K.BTSNAME;
复制代码 上面是代码A
下面是代码B
- SELECT A2.HBSC_NAME, ADD_GTRX.CELLID, A2.BTSID, A2.CN, A2.TRXTP, COUNT(A2.TRXID) AS TRXNUM, SUM(A2.PTNUMA1) AS PTNUM
- 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)
- GROUP BY A2.HBSC_NAME, ADD_GTRX.CELLID, A2.BTSID, A2.CN, A2.TRXTP;
复制代码
代码A应该是包含代码B的,可是代码B的运行速度远低于代码A的运行速度。请问这是什么原因啊??? |
|