¥»©«³Ì«á¥Ñ sammyc ©ó 2011-5-23 17:45 ½s¿è
¦bvba ¤º ³s¨ìsql ªº¼Æ¾Ú
»Ý±Ngxmc ¤º¥]¬A",1," ªº¦r¦ê¿z¿ï¶ñ¤Jt_01¤º, ¦ý¤@ª½¿z¿ï¤£¨ì
sql »y¥y
select zdh, gxmc ,
case gxmc when '%,1,' then sum(shul)
when ',1,' then sum(shul)
when ',1,%' then sum(shul)
when '%,1,%' then sum(shul)
end "T_01" ,
case gxmc when ',2,' then sum(shul) end "T_02"
from jjgzmxb
where zdh ='12330-01a'
group by zdh, gxmc
jjgzmxb¸ê®Æ
zdh gxmc T_01 T_02
12330-01A ,1,14,15,36,
12330-01A ,12,10,
12330-01A ,13,
12330-01A ,1, 14256
12330-01A ,1,2,
12330-01A ,1,20,
12330-01A ,2, 4157
12330-01A ,10,11,
12330-01A ,10,11,19,
12330-01A ,10,15,
12330-01A ,11, |