Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 15 Aug 2006 @ 18:18:19 GMT


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


Subj:   Re: Max And Count without Group by
 
From:   Victor Sokovin

The regular MAX and COUNT should do the job. Depending on whether you need to count all dates or just distinct ones try the following:

     sel COL_A as Product, MAX(COL_B) as Max_Date, COUNT(COL_B) as Total
     from the_table
     group by COL_A ;

or

     sel COL_A as Product, MAX(COL_B) as Max_Date, COUNT(DISTINCT COL_B) as
     Total
     from the_table
     group by COL_A ;

Regards,

Victor



     
  <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