数据库字段存的是多个用户的ID,取出来是多个用户的姓名

'990000000000000001,990000000000000002,990000000000000003' 存储多个用户的ID的字段,
bos_t_user 用户表 user_name用户姓名字段
select wm_concat(t.user_name) username
  from bos_t_user t
 where t.user_id in
       (with tab as (select '990000000000000001,990000000000000002,990000000000000003' id
           from ZL_T_PROJECT
          where project_id = 990000000000000005)
         select substr(',' || id || ',',
                       instr(',' || id || ',', ',', 1, level) + 1,
                       instr(',' || id || ',', ',', 1, level + 1) -
                       instr(',' || id || ',', ',', 1, level) - 1) newid
           from tab
         connect by level <= length(',' || id || ',') -
                    length(replace(',' || id || ',', ',', '')) - 1
        )

 

你可能感兴趣的:(数据库)