Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 24 Feb 2004 @ 13:13:15 GMT


     
  <Prev Next>   <<First <Prev
Next>
Last>>
 


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



     
  <Prev Next>   <<First <Prev
Next>
Last>>
 
 
 
 
 
 
 
 
 
  
  Top Home Privacy Feedback  
 
 
Copyright for the TeradataForum (TDATA-L), Manta BlueSky    
Copyright 2016 - All Rights Reserved    
Last Modified: 15 Jun 2023