select distinct 
    a.id, a.number, b.number as school_number, b.id as school_id 
from
    (select distinct a.id, a.number 
     from faculty a 
     where a.status = 'active') as t1
full outer join
    (select distinct b.id, b.number 
     from staff b 
     where b.status = 'active') as t2 on t1.id = t2.id我想在Server中使用上述代码在多个case语句中使用。怎么做?
为此,我创建了一个视图:
create view v_data 
as
    (select 
         name_loc,
         case 
             when name_loc like '%city%' or
             when name_loc like '%cities%'  
                 then 'Survey'现在,我被困住了如何在case语句中使用第一段代码,该语句存在于虚拟表中,即视图中。
我在创建视图时出错了。
当子查询跟随=,!=,<=,>=,>或子查询用作表达式时,返回的子查询超过1 value.this是不允许的
发布于 2022-03-16 20:35:09
您的情况表示(必须返回)一个列,您不能返回多个列,例如,从第一个查询中的SELECT返回。将子查询的输出减少到一列。
也许您可以通过在不同条件下多次使用高级查询并将它们的输出与UNION连接到一起来实现您想要的结果。但你到底想做什么还不太清楚。
https://stackoverflow.com/questions/71501754
复制相似问题