I have a sub query in which I am getting error:
"Only one expression can be specified in the select list when the subquery is not introduced with EXISTS."
I know the problem is in select that I can't have the column but how can I include the total_gross within this select?
Thanks.
I need to include the total_gorss within this erncode.
Blockquote
,(select total_gross, erncode,
case
when erncode ='5' then 'Sal'
when erncode='55' then 'OclLump'
when erncode='35' then 'Promo'
when erncode='38' then 'Lump'
when erncode='39' then 'Reclass'
when erncode='40' then ' LatT'
end
from EMployee )
select total_gross,
case erncode
when erncode ='5' then 'Sal'
when erncode='55' then 'OclLump'
when erncode='35' then 'Promo'
when erncode='38' then 'Lump'
when erncode='39' then 'Reclass'
when erncode='40' then ' LatT'
end
from EMployee
sorry, The full query is complex and about 2 -3 page, the sub query is what I posted.I think I figured it out, using it as:
select
column1,
column2,
column3,
------------- sub query.-----
,( select
total_gross =CASE
when erncode ='5' then 'Sal'
when erncode='55' then 'OclLump'
when erncode='35' then 'Promo'
when erncode='38' then 'Lump'
when erncode='39' then 'Reclass'
when erncode='40' then ' LatT'
end
from Employee)