不积跬步,无以至千里

博客园 首页 新随笔 联系 订阅 管理

一个表字段中存了id,并以逗号分隔,id对应的详细信息在另一个表中,取其中逗号分隔的id对应表字段的名称写法,

 

select
                u.job_id,
                (select dept_name from dept_t where dept_id =u.dept_id) dept_name,
                u.month,
                u.title,

(select to_char(wmsys.wm_concat(t.dept_name))  from cl_sys_dept_t t where t.dept_id in(SELECT REGEXP_SUBSTR (u.co_depts,'[^,]+',1,LEVEL) FROM dual CONNECT BY REGEXP_SUBSTR (u.co_depts,'[^,]+',1,LEVEL) IS NOT NULL)) co_depts

from jobs_dept_t u

posted on 2017-02-22 12:08  Zeroassetsor  阅读(358)  评论(0)    收藏  举报