Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Sat, 24 Jun 2006 @ 10:11:39 GMT


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


Subj:   Re: Can't get ROW_NUMBER to Work
 
From:   Dieter Noeth

Rick.Tangri wrote:

  I need to add a counter to this query. I was thinking just to add this line:  


          > ROW_NUMBER() OVER (PARTITION BY E.column1 ORDER BY 2)
  For some reason this doesn't work- I get ones in the new column.  


The reason is the PARTITION, it restarts the counter for each new column1, so you just have to remove it.

But you'll have to modify the ORDER, too. You can't use a column number here, it's the *value* 2, so it's useless (and will probably skew spool):

     ROW_NUMBER() OVER (ORDER BY Column2)

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