Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 25 May 2011 @ 14:05:59 GMT


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


Subj:   Re: OLAP function and tracking data changes
 
From:   Usenko, Yuriy

Hi.

You can use RANK() or ROW_NUMBER().

I think somethink like this

     SELECT
      D.field1
     , D.field2
     , D.field3
     , D.start_date
     , D.end_date
     from
     (
     SELECT
     field1
     , field2
     , field3
     , field4
     , start_date
     , end_date
     , RANK() OVER ( PARTITION BY
                            field1
                          , field2
                          , field3
                    ORDER BY
                          start_date ASC ) as
     R_ORDER
     ) D
     WHERE D.R_ORDER = 1


     
  <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