case when嵌套

select case parent_status 
         when 1 then  
              case child_status
              when 1 then 'aa'
              when 2 then 'bb'
              when 3 then 'cc'
               else ''
              end 
        when 2 then  
              case child_status
              when 1 then 'dd'
              when 2 then 'ee'
              when 3 then 'ff'
               else ''
              end 
        when 3 then  
              case child_status
              when 1 then 'gg'
              when 2 then 'hh'
              when 3 then 'll'
               else ''
              end 
    else ''            
    end  
  from table; 
————————————————
版权声明:本文为CSDN博主「qq_28933803」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_28933803/article/details/83417356
posted @ 2019-12-13 10:34  ProZkb  阅读(424)  评论(0编辑  收藏  举报