返回列表 上一主題 發帖

求助 excel vba 查找 sql table 欄位內包含字段

求助 excel vba 查找 sql table 欄位內包含字段

本帖最後由 sammyc 於 2011-5-23 17:45 編輯

vba 內 連到sql 的數據
需將gxmc 內包括",1," 的字串篩選填入t_01內, 但一直篩選不到
sql 語句
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,
50 字節以內
不支持自定義 Discuz! 代碼

        靜思自在 : 【行善要及時】行善要及時,功德要持續。如燒開水一般,未燒開之前千萬不要停熄火候,否則重來就太費事了。
返回列表 上一主題