22,210
社区成员
发帖
与我相关
我的任务
分享
select ryfl.row_id,ryfl.cmid,ryfl.flid,cmxx.cmxm,cmxx.cmsfzh,flxx.flmc,flxx.jedw,cmflffxx.nf,
if(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '1' then cmflffxx.yf else '' end))) as wc1,
if(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '2' then cmflffxx.yf else '' end))) as wc2,
if(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '3' then cmflffxx.yf else '' end))) as wc3,
if(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '4' then cmflffxx.yf else '' end))) as wc4,
if(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '5' then cmflffxx.yf else '' end))) as wc5,
if(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '6' then cmflffxx.yf else '' end))) as wc6,
if(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '7' then cmflffxx.yf else '' end))) as wc7,
if(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '8' then cmflffxx.yf else '' end))) as wc8,
if(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '9' then cmflffxx.yf else '' end))) as wc9,
if(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '10' then cmflffxx.yf else '' end))) as wc10,
if(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '11' then cmflffxx.yf else '' end))) as wc11,
if(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end)=0,'',floor(sum(case cmflffxx.yf when '12' then cmflffxx.yf else '' end))) as wc12
from ryfl
left join (select cmflffxx.yf,cmflffxx.nf,cmflffxx.cmid,cmflffxx.flid,cmflffxx.ryflid from cmflffxx where cmflffxx.nf = '2013') cmflffxx
on ryfl.cmid = cmflffxx.cmid and ryfl.flid = cmflffxx.flid and ryfl.row_id = cmflffxx.ryflid