![](//teradataforum.com/imgs/ptdfw1.gif) |
![](//teradataforum.com/imgs/ptdfw2.gif) |
Archives of the TeradataForum
Message Posted: Tue, 24 Feb 2004 @ 13:13:15 GMT
Subj: | | Re: Intense Query question |
|
From: | | de Wet, Johannes M |
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
UnumProvident
| |