Oracle "行转列"搭配"临时视图"

前端之家收集整理的这篇文章主要介绍了Oracle "行转列"搭配"临时视图"前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

with T_EXPERT as (select E.EXPERT_ID_,E.COM_CODE_,E.COM_NAME_,E.EMP_NAME_,E.STATUS_,ER.PARENT_PRO_CODE_,ER.PRO_CODE_ from MP_EXPERT E inner join MP_EXPERT_RELATION ER on ER.EXPERT_ID_ = E.EXPERT_ID_ and ER.PARENT_PRO_CODE_ is not null
 )select T_EXPERT.EXPERT_ID_,COM_CODE_,COM_NAME_,EMP_NAME_,STATUS_,(select wm_concat(distinct PARENT_PRO_CODE_) from T_EXPERT T where T.EMP_NAME_ = T_EXPERT.EMP_NAME_) as PARENT_PRO_CODE_,(select wm_concat(PRO_CODE_) from T_EXPERT T where T.EMP_NAME_ = T_EXPERT.EMP_NAME_) as CHILD_PRO_CODE_ from T_EXPERT group by T_EXPERT.EXPERT_ID_,T_EXPERT.COM_CODE_,T_EXPERT.COM_NAME_,T_EXPERT.EMP_NAME_,T_EXPERT.STATUS_

分享图片

猜你在找的Oracle相关文章