首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

求该句SQL的优化。单表。解决办法

2012-03-05 
求该句SQL的优化。单表。SELECTfazhudanhao,changjiadaima,RMBASExpr1,SUM(waixiejine)ASJE,xuanzezhe,waixi

求该句SQL的优化。单表。
SELECT   fazhudanhao,   changjiadaima,   'RMB '   AS   Expr1,   SUM(waixiejine)   AS   JE,   xuanzezhe,  
            waixieriqi
FROM   AC09
WHERE   (waixieriqi   > =   '2007/08/28 ')   AND   (changjiadaima   <>   ' ')   AND   (jiesuanbiaoshi   =   'Y ')  
            AND   (changjiadaima   =   'GA00130 ')   AND   (waizhuqufen   IN   ( 'A,  
            'B))
GROUP   BY   fazhudanhao,   changjiadaima,   xuanzezhe,   waixieriqi




[解决办法]
SELECT fazhudanhao, changjiadaima, 'RMB ' AS Expr1, SUM(waixiejine) AS JE, xuanzezhe,
waixieriqi
FROM AC09
WHERE jiesuanbiaoshi = 'Y ' AND changjiadaima = 'GA00130 ' AND (waizhuqufen= 'A ' or waizhuqufen= 'B ') AND (waixieriqi > = '2007/08/28 ') AND (changjiadaima <> ' ')
GROUP BY fazhudanhao, changjiadaima, xuanzezhe, waixieriqi

热点排行