任何人都可以帮助案例陈述吗?
以下 CASE STATEMENT 是我的 SQL 管理中的结果。
select
Column1 = case when Column1 = 'true' then 'Y'
ELSE 'N'
END ,
Column2 = case when Column1 = 'true' then 'Y'
ELSE 'N'
END ,
SHARED = case when Column1='true' AND Column1='true' THEN 'SHARED' ELSE 'NOTSHARED'
END
FROM Table
结果:
Column1 Column2 SHARED
Y N NOTSHARED
N N NOTSHARED
Y N NOTSHARED
N N NOTSHARED
N N NOTSHARED
Y N NOTSHARED
Y N NOTSHARED
Y N NOTSHARED
N N NOTSHARED
Y N NOTSHARED
N N NOTSHARED
Y N NOTSHARED
Y N NOTSHARED
N N NOTSHARED
我必须使用上述语句创建一个新的命名计算。怎么做?
当我尝试这个时,它显示错误:
Deferred prepare could not be completed.
Statement(s) could not be prepared.
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.