I have a query wherein there are multiple case statements in the select clause
The simpe SQL query works fine
Code: Select all
select pm_id,pm_name,
case when regexp_like(pm_name,'((ab)|(kfd)|(nm))')
then 'yes'
else 'out'
end as result
from tempdb.litab;
pm_id | pm_name | result
-------+----------+--------
1 | abkd | yes
2 | dfgkl | out
3 | kmnolk | out
4 | zzzxxbsd | out
(4 rows)
Code: Select all
select pm_id,pm_name,
case when regexp_like(pm_name,'((ab)|(kfd)|(nm))')
then 'yes'
else 'out'
end as result,
case when result = 0
then 'g'
else 'b'
end as c_reult
from tempdb.litab;
ERROR 2624: Column "result" does not exist
Are there any workaround for this..