Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql server 2008 SQL Server大型嵌套案例(1个案例内)_Sql Server 2008_Nested_Case When - Fatal编程技术网

Sql server 2008 SQL Server大型嵌套案例(1个案例内)

Sql server 2008 SQL Server大型嵌套案例(1个案例内),sql-server-2008,nested,case-when,Sql Server 2008,Nested,Case When,我有一个非常大的嵌套案例,我想把它放在另一个案例中——所以当我这样做的时候,我总是会出错。删除第一个案例时,查询将起作用。请帮忙。多谢各位 Case when ( Case when c1 = c2 then c1 else case when c1 <> c2 and c1 = c3 then c1 else case when c1 <> c2 and c2 = c3 then c2 else

我有一个非常大的嵌套案例,我想把它放在另一个案例中——所以当我这样做的时候,我总是会出错。删除第一个案例时,查询将起作用。请帮忙。多谢各位

Case when
    ( Case when c1 = c2 then c1 else
         case when c1 <> c2 and c1 = c3 then c1 else
              case when c1 <> c2 and c2 = c3 then c2 else
                  case when c1 <> c2 and c2 <> c3 and c3 <> c1 then c1 end
                     end 
               end 
          end ) is null then '_0' else '-true' end as Final_cc
CASE WHEN
        (Case  
              when c1 = c2                                  then c1 
              when c1 <> c2 and c1 = c3                     then c1 
              when c1 <> c2 and and c1 <> c3 and c2 = c3    then c2 
              when c1 <> c2 and c2 <> c3 and c3 <> c1       then c1 
        END)  is null 
      then '_0' 
        else '-true'  end as Final_cc