SELECTa1.juanhao,a1.c1,a2.c2,a3.c3,a4.c4,a5.c5,a6.c6FROM"+"(selectjuanhao,COUNT(CASEWHENzigao="+zg1+"THEN1END)ASc1FROMtable1FORCEINDEX(zg)GROUPBYjuanhao)ASa1,"+"(selectju...
SELECT a1.juanhao,a1.c1,a2.c2,a3.c3,a4.c4,a5.c5,a6.c6 FROM"+"(select juanhao,COUNT(CASE WHEN zigao="+zg1+" THEN 1 END) AS c1 FROM table1 FORCE INDEX(zg) GROUP BY juanhao) AS a1,"+"(select juanhao,COUNT(CASE WHEN zigao="+zg2+" THEN 1 END) AS c2 FROM table1 FORCE INDEX(zg) GROUP BY juanhao) AS a2,"+"(select juanhao,COUNT(CASE WHEN zigao="+zg3+" THEN 1 END) AS c3 FROM table1 FORCE INDEX(zg) GROUP BY juanhao) AS a3,"+"(select juanhao,COUNT(CASE WHEN zigao="+zg4+" THEN 1 END) AS c4 FROM table1 FORCE INDEX(zg) GROUP BY juanhao) AS a4,"+"(select juanhao,COUNT(CASE WHEN zigao="+zg5+" THEN 1 END) AS c5 FROM table1 FORCE INDEX(zg) GROUP BY juanhao) AS a5,"+"(select juanhao,COUNT(CASE WHEN zigao="+zg6+" THEN 1 END) AS c6 FROM table1 FORCE INDEX(zg) GROUP BY juanhao) AS a6 "+"where a1.juanhao=a2.juanhao AND a2.juanhao=a3.juanhao AND a3.juanhao=a4.juanhao AND a4.juanhao=a5.juanhao AND a5.juanhao=a6.juanhao
展开