|  |  | Archives of the TeradataForumMessage Posted: Tue, 15 Aug 2006 @ 18:18:19 GMT
 
 
  
| 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 
 
 |  |