October 17th, 2017, 07:34 AM
Join Date: Oct 2017
Time spent in forums: 12 m 50 sec
Reputation Power: 0
Originally Posted by digioleg54
I have statement:
from table A
I want to see the result headers:
but no col4 and col 5 even though they are in select statement.
I try to do:
case when exists (slect 1 from table B) then col4 end
case when exists (slect 1 from table B) then col5 end
But in this case I get result :
col1 col2 col3 col4 col5
1 1 1
2 2 2
col4 and col5 exists, but with value NULL.
Please help me withis query.
Please try below:
select a.COMP_CODE, a.BRANCH, a.PLAN_NBR from (select COMP_CODE, BRANCH, PLAN_NBR, PLAN_SEQ, LINE_NBR