ビュー内では、select文を1つのケースに入れ、それを列としてdelcaredします。列名は 'IR2'Microsoft SQLを使用して作成された列の式
'IR2'列の大文字と小文字は区別できますか?
「無効な列名 'IR2'」というエラーが表示されます。
私の回避策は何ですか?
case when r.ana = 'nh3' and r.serv='energy' and exists(select 1 from results x where x.no=r.no and x.ana='nh3' and x.sa='rejected' and x.serv <> 'energy')
then '*' else r.sa end as IR2,
CASE IR2 WHEN 'Released' then
''
ELSE
'*'
END AS IR
あなたは、select句で別名IR2を使用することはできません – sle1306