Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 27 Apr 2004 @ 18:50:18 GMT


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


Subj:   Conditional max
 
From:   Jeff Ohlman

Given the following set what is the SIMPLEST way to select PARENT, CHILD, MAX(AMT) where AMT is not null, but if AMT is null then select PARENT, MAX(CHILD).

Where PARENT is CHAR(13), CHILD is CHAR(13) and AMT is DECIMAL(12,2)

     PARENT    CHILD          AMT
     X          A             NULL
     X          B             NULL
     X          C             NULL

This should give X, C, NULL

     PARENT    CHILD          AMT
     Y          F             25.00
     Y          G             40.00
     Y          H             NULL

This should give Y, G, 40



     
  <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