All Forums General
Agustin_Luna_91 1 post Joined 02/15
09 Mar 2015
Case Statement after a Union

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;

 

After that I need created a computed field about the CustRef. I thought in a case statement but I do not know how implement.

Any suggestion 

Glass 225 posts Joined 04/10
10 Mar 2015

Make sure your select lists are same length and datatype.
 

SELECT CUSTOMER_REF_NAM AS CustRef, CASE WHEN cust_ref = 'X' THEN 'value' END FROM SaleOrder
UNION
SELECT CUSTOMER_REF_NAM AS CustRef , CASE WHEN cust_ref = 'X' THEN 'value' END FROM AL1;
 
Rglass

You must sign in to leave a comment.