Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Tue, 01 Dec 2009 @ 20:12:58 GMT


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


Subj:   Re: Incrementing count within a group of records
 
From:   Dieter Noeth

David Clough wrote:

  The second column is simply generated (using ROW_NUMBER() OVER (ORDER BY DTE_DT ASC) AS DAY_NR), which will continue to increment for all days in the calendar, and continue to increment after 1998 - as required.  


  ...  


  So, basically, I want to have a count which only changes by 1, on change of that fourth column, ordering by Year. Within 1998 it would actually look the same as column four but when we go to 1999, that column would continue to increment, but again only when the week number changes.  


Sounds like ((DAY_NR - 1) / 7) + 1


Dieter



     
  <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