|
Archives of the TeradataForumMessage Posted: Tue, 24 Feb 2004 @ 13:13:15 GMT
John, I may be missing something here, but will something like this work for you? SELECT C.cust_id ,CASE WHEN MAX(A.Acct_Status_Cd) NE MIN(A.Acct_status_cd) THEN 'Mixed' WHEN MAX(A.Acct_Status_Cd) = 'A' THEN 'Active only' WHEN MAX(A.Acct_Status_Cd) = 'C' THEN 'Cancelled only' END FROM cust c JOIN prod p ON C.Product_cd = P.Product_Cd JOIN acct a ON P.Account_No = A.Account_No WHERE c.product_cd = p.product_cd and p.account_no = A.account_no GROUP BY 1 ORDER BY 1; Johannes de Wet
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||