Gqw,
2019-03-29 15:15
采纳率: 0%
浏览 611

gbase unpivot用法报错

(select XZQH_DM,
QJ,
xz_dm,
cb_code,
decode(cb_code,
'CBRS',
'参保人数年末数',
'JFRS',
'实际缴费人数年末数',
'CBRS_ZZ',
'参保人数年末数_在职员工',
'CBRS_LTX',
'参保人数年末数_离退休') cb_name,
rs
from (SELECT XZQH_DM,
QJ,
1020201 xz_dm,
shiy_cbrsnms cbrs,
shiy_sjjfrsnms jfrs,
null cbrs_zz,
null cbrs_ltx
from CZSB_SBJ_JS_BC_ZB
union all
select XZQH_DM,
qj,
1020401 xz_dm,
gs_cbrsnms cbrs,
gs_sjjfrsnms jfrs,
null cbrs_zz,
null cbrs_ltx
from CZSB_SBJ_JS_BC_ZB
union all
select XZQH_DM,
qj,
1020501 xz_dm,
sy_cbrsnms cbrs,
sy_sjjfrsnms jfrs ,
null cbrs_zz ,
null cbrs_ltx
from CZSB_SBJ_JS_BC_ZB
union all
select XZQH_DM,
qj,
1020311 xz_dm,
null cbrs ,
zgyil_sjjfrsnms jfrs ,
null cbrs_zz,
null cbrs_ltx
from CZSB_SBJ_JS_BC_ZB
union all
select XZQH_DM,
qj,
1020311 xz_dm,
zgyil_cbrsnms cbrs,
null jfrs,
zgyil_cbrsnms_zz cbrs_zz,
zgyil_cbrsnms_ltx cbrs_ltx
from CZSB_SBJ_JS_BC_QT
union all
select XZQH_DM,
qj,
1020111 xz_dm,
zgyl_cbrsnms cbrs ,
zgyl_sjjfrsnms jfrs,
zgyl_cbrsnms_zz cbrs_zz,
zgyl_cbrsnms_ltx cbrs_ltx
from CZSB_SBJ_JS_BC_YL
union all
select XZQH_DM,
qj,
1020113 xz_dm,
jgyl_cbrsnms cbrs ,
jgyl_sjjfrsnms jfrs,
jgyl_cbrsnms_zz cbrs_zz,
jgyl_cbrsnms_ltx cbrs_ltx
from CZSB_SBJ_JS_BC_YL
union all
select XZQH_DM,
qj,
1020198 xz_dm,
cxyl_cbrsnms cbrs ,
cxyl_sjjfrsnms jfrs,
null cbrs_zz,
null cbrs_ltx
from CZSB_SBJ_JS_BC_YL
union all
select XZQH_DM,
qj,
1020391 xz_dm,
cxyil_cbrsnms cbrs,
null jfrs,
null cbrs_zz,
null cbrs_ltx
from CZSB_SBJ_JS_BC_YIL
union all
select XZQH_DM,
qj,
1020314 xz_dm,
czyil_cbrsnms cbrs,
null jfrs,
null cbrs_zz,
null cbrs_ltx
from CZSB_SBJ_JS_BC_YIL
union all
select XZQH_DM,
qj,
1020313 xz_dm,
xnh_cbrsnms cbrs,
null jfrs,
null cbrs_zz,
null cbrs_ltx
from CZSB_SBJ_JS_BC_YIL)
unpivot(rs for cb_code in(cbrs,
jfrs,
cbrs_zz,
cbrs_ltx)) )

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • Gqw, 2019-03-29 15:15

    图片说明

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题