0 - 2 of 2 tags for case stament

Hi,
I'm a java developer and new to TD and looking for some input/advice.
We have a query where we are using "CASE". After rough profilling found this "CASE" part is taking more time compared to others. The query is working fine for smaller data sets but it is CPU timing out of larger datasets . How do I get around with the CPU timeout ?

Hi everyone, 
Sorry for my English. I´m not good writer.
 
Well, I made a Union

SELECT  CUSTOMER_REF_NAM as CustRef FROM SaleOrder;

 

Union 

 

SELECT CUSTOMER_REF_NAM as CustRef FROM AL1;