我有一个这样的示例查询:
select t1.name,t1.bday,t2.address,t2.contactnum
from table1 as t1
left join table2 as t2 on t1.p_id = t2.p_id
where (case when @qualified = '2' then t2.role is null
case when @qualified = '3' then t2.role is not null` end)
当我执行查询时,会弹出一个错误指示:
关键字“is”附近的语法不正确。
有什么想法可以解决这个问题吗?
谢谢!
此查询的目的是根据参数@qualified 上传递的值获取表中的空行和非空行。