SQL优化
< 返回列表时间: 2018-04-19来源:开源中国
HDC调试需求开发(15万预算),能者速来!>>> SELECT A .*, gjswjg.SWJGMC AS gjswjgmc FROM ( SELECT GJSWJG_DM, "COUNT" (A .SHXYDM) AS gsdjxxhs, "COUNT" ( CASE WHEN GJZT_DM = '1' THEN 1 WHEN GJZT_DM = '2' THEN 1 END ) AS gjzs, "COUNT" ( CASE WHEN ( A .JHBZ = 'Y' AND nsrxx.NSRZT_DM = '03' ) THEN 1 END ) AS yjhzc, "COUNT" ( CASE WHEN ( A .JHBZ = 'Y' AND nsrxx.NSRZT_DM = '05' ) THEN 1 END ) AS yjhbzc, "COUNT" ( CASE WHEN ( A .JHBZ = 'Y' AND nsrxx.NSRZT_DM = '07' ) THEN 1 END ) AS yjhzx, "COUNT" ( CASE WHEN ( A .JHBZ = 'N' AND nsrxx.NSRZT_DM = '03' ) THEN 1 END ) AS wjhzc, "COUNT" ( CASE WHEN ( A .JHBZ = 'N' AND nsrxx.NSRZT_DM = '07' ) THEN 1 END ) AS wjhzx FROM DJ_SLDJXX A LEFT JOIN DJ_NSRXX nsrxx ON A .nsrsbh = nsrxx.nsrsbh WHERE 1 = 1 GROUP BY GJSWJG_DM ) A LEFT JOIN DM_GY_SWJG gjswjg ON A .gjswjg_dm = gjswjg.SWJG_DM
这段SQL运行太慢了 怎么加快
热门排行