isames
asked on
SQL Query
Is it possible to also write the following query into a CASE statement?
select arcf_cust_n, ' ', arcf_name
from ihih, arcf
where RSIH_CUST_N = arcf_cust_n and arcf_parent_cust_n = ' '
union
select arcf_parent_cust_n, arcf_cust_n,
(select b.arcf_name as parent_name
from arcf b
where b.arcf_cust_n = childcust.arcf_parent_cust _n) name
from ihih, arcf childcust
where RSIH_CUST_N = arcf_cust_n and arcf_parent_cust_n <> ' '
select arcf_cust_n, ' ', arcf_name
from ihih, arcf
where RSIH_CUST_N = arcf_cust_n and arcf_parent_cust_n = ' '
union
select arcf_parent_cust_n, arcf_cust_n,
(select b.arcf_name as parent_name
from arcf b
where b.arcf_cust_n = childcust.arcf_parent_cust
from ihih, arcf childcust
where RSIH_CUST_N = arcf_cust_n and arcf_parent_cust_n <> ' '
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for your help.
Sorry, I've been SWAMPED at work lately.
I just took the columns that got listed in the first query and had them be shown when the arcf_parent_cust_n column is = ' ', and the column values in the second query to be listed if it wasn't.
I just took the columns that got listed in the first query and had them be shown when the arcf_parent_cust_n column is = ' ', and the column values in the second query to be listed if it wasn't.
ASKER
Thanks!!!