原创

fn_getpy

select c.*,fn_getpy(c_name) || '@' ||
               (case when newou like '%潮州%' then 'cz.gd.csg.cn' when
                newou like '%东莞%' then 'dg.gd.csg.cn' when newou like '%佛山%' then 'fs.gd.csg.cn' when
                newou like '%河源%' then 'hy.gd.csg.cn' when newou like '%惠州%' then 'hz.gd.csg.cn' when
                newou like '%江门%' then 'jm.gd.csg.cn' when newou like '%揭阳%' then 'jy.gd.csg.cn' when
                newou like '%清远%' then 'qy.gd.csg.cn' when newou like '%汕头%' then 'st.gd.csg.cn' when
                newou like '%汕尾%' then 'sw.gd.csg.cn' when newou like '%韶关%' then 'sg.gd.csg.cn' when
                newou like '%云浮%' then 'yf.gd.csg.cn' when newou like '%湛江%' then 'zj.gd.csg.cn' when
                newou like '%肇庆%' then 'zq.gd.csg.cn' when newou like '%中山%' then 'zs.gd.csg.cn' when
                newou like '%珠海%' then 'zh.gd.csg.cn' when newou like '%茂名%' then 'mm.gd.csg.cn' when
                newou like '%梅州%' then 'mz.gd.csg.cn' when newou like '%阳江%' then 'yj.gd.csg.cn'
                else  'gd.csg.cn' end)
 as login_name from (
select * from (
select bb.*,aa.newou from 试点人资_人员_0408 bb
join isc_baseorg aa
on bb.c_org = aa.sysdataid) a
where a.newou like '%江门%' or a.newou like '%阳江%' or a.newou like '%惠州%'
) c

正文到此结束
本文目录