BRYAN writes "Hello.. I work in an environment with 2 separate regions (prod and test). I have a SQL query that runs perfectly in prod and gives different results in test. Here is the SQL query:(SELECT TERMINAL_ID AS CCID, AUDIT_STATUS_CODE AS AUDCODE, 'M' AS AUDTYPE, COUNT(*) AS AUDCNT FROM CUSTOMER_MASK A , CUSTOMER_PROFILE B WHERE FK_CUSTOMER_NUMBER = CUSTOMER_NUMBER AND (B.CARRIER_SCAC_CD = ' ' OR B.CARRIER_SCAC_CD = 'ARFW') GROUP BY TERMINAL_ID, AUDIT_STATUS_CODE UNION ALL SELECT TERMINAL_ID AS AUDUSER, AUDIT_STATUS_CODE AS AUDCODE, 'I' AS AUDTYPE, COUNT(*) AS AUDCNT FROM CUSTOMER_ITEM A , CUSTOMER_PROFILE B WHERE FK_CUSTOMER_NUMBER = CUSTOMER_NUMBER AND (B.CARRIER_SCAC_CD = ' ' OR B.CARRIER_SCAC_CD = 'ARFW') GROUP BY TERMINAL_ID, AUDIT_STATUS_CODE FOR FETCH ONLY);
When we run this in Prod, we get 4 colums: CCID, AUDCODE, AUDTYPE and AUDCNT. When we run this in test, we get 4 colums: col1, AUDCODE, AUDTYPE and AUDCNT. Because we get col1 instead of CCID for or column heading, our program is abending later down the line. I see that the problem is caused by the field TERMINAL_ID having 2 different names (CCID and AUDUSER). We are trying to figure out why we are getting different results for the same query? (By the way, prod and test has the same data in the DB2 tables.)Thanks,Bryan N."