select rtrim(Kmdm) as Kmdm,
rtrim(Fzhs) as Fzhs,
rtrim(Yefx) as Yefx,
rtrim(Kmlb) as Kmlb,
'${annual}' as annual,
'${ACCOUNT_CODE}' as ACCOUNT_CODE,
kmxz,rtrim(kmmc) as kmmc,zjm,
'1'+kmxz+'00' as code_type,
'0' as ENABLED,'0' as STATE,
(case
when len(rtrim(Kmdm))=3 then '000'
when len(rtrim(Kmdm))>3 then substring(rtrim(Kmdm),1,len(rtrim(Kmdm))-2)
end) as parent_code,
(select count(1) from gl_kmxx b where rtrim(b.kmdm) like rtrim(a.Kmdm) + '%' ) as is_sub
from gl_kmxx a where gsdm=''
sqlserver语句
最新推荐文章于 2024-08-27 15:51:22 发布