sql left join on

select sysuser.userid,
       sysuser.groupid,
       sysuser.sysid,
       nvl( userjd.mc,nvl(useryy.mc,usergys.mc)) sysmc
  from sysuser
  left join userjd on sysuser.sysid = userjd.id
  left join useryy on sysuser.sysid = useryy.id
  left join usergys on sysuser.sysid = usergys.id

select SYSUSER.id,
         SYSUSER.userid,
         SYSUSER.username,
         SYSUSER.groupid,
         SYSUSER.sysid,
         decode(SYSUSER.Groupid,
                '1',
                (select mc from userjd where id = sysuser.sysid),
                '2',
                (select mc from userjd where id = sysuser.sysid),
                '3',
                (select mc from useryy where id = sysuser.sysid),
                '4',
                (select mc from usergys where id = sysuser.sysid)
                ) sysmc
       
          from SYSUSER

上一篇:vue命令行创建运行工程


下一篇:Excel Sheet Column Title