Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Thu, 12 Jan 2012 @ 11:18:34 GMT


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


Subj:   Issue getting a rank
 
From:   MARIA JOSEFA RODRIGUEZ POSADA

Hi,

I need to make a rank for the next registers. I mean, from this?

     CLIENT DATE_INI          DATE_FIN        COMPANY
      100                   1-1-2009         1-2-2009                A
      100                   2-2-2009         1-4-2009                A
      100                   2-4-2009         1-6-2009                A
      100                   2-6-2009         1-8-2009                B
      100                   2-8-2009         1-1-2100                A

... To this

     CLIENT DATE_INI          DATE_FIN        COMPANY       RANK
      100                   1-1-2009         1-2-2009 A                1
      100                   2-2-2009         1-4-2009 A                1
      100                   2-4-2009         1-6-2009 A                1
      100                   2-6-2009         1-8-2009 B                2
      100                   2-8-2009         1-1-2100 A                3

I tried

     RANK() OVER
       (PARTITION BY client ORDER BY date_fin
        ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING)

It didn't work.

Any idea how to make this rank?


Thanks a lot.

FINA RODRIGUEZ POSADA
Analista BI



     
  <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