• oracle sql语句问题,帮忙看一下,谢谢了!!!
  • 其它

     CASE
                 WHEN (select capgrade
                         from tb_tpost_userpost
                        where mpostid = i.mpostid
                          and spostid = i.spostid
                          and idcard = r.idcard) = 1 THEN
                  'Ⅰ级'
                 WHEN (select capgrade
                         from tb_tpost_userpost
                        where mpostid = i.mpostid
                          and spostid = i.spostid
                          and idcard = r.idcard) = 2 THEN
                  'Ⅱ级'
                 WHEN (select capgrade
                         from tb_tpost_userpost
                        where mpostid = i.mpostid
                          and spostid = i.spostid
                          and idcard = r.idcard) = 3 THEN
                  'Ⅲ级'
                 WHEN (select capgrade
                         from tb_tpost_userpost
                        where mpostid = i.mpostid
                          and spostid = i.spostid
                          and idcard = r.idcard) = 4 THEN
                  'Ⅳ级'
                 WHEN (select capgrade
                         from tb_tpost_userpost
                        where mpostid = i.mpostid
                          and spostid = i.spostid
                          and idcard = r.idcard) = 5 THEN
                  'Ⅴ级'
                 ELSE
                  '尚无等级'
               END usercapgrade

语句太过长了,这个怎么改成外层嵌套一次查询,大佬帮忙看一下,谢谢

  • 就几件    2019-11-06 10:36:22
  • 阅读 585    收藏 0    回答 1
  • 邀请
  • 收藏
  • 分享
发送
登录 后发表评论
  • 51testing软件测试圈微信