Home Page for the TeradataForum
 

Archives of the TeradataForum

Message Posted: Wed, 25 May 2011 @ 10:10:25 GMT


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


Subj:   Re: OLAP function and tracking data changes
 
From:   Carpio Garcia Carlos

I would start with something like:

     Select
       field1,
       field2,
       field3,
       start_date,
         Row_number() Over (Partition By field1, field2, field3) order_field
     From
       MyTable
     Qualify
       order_field = 1
     Order By start_date

If the end_date is always one day less than the start_date of the next "step", you can join this query with itself using Query1.order_field=Query2.order_field+1 or something like that.

Carlos Carpio Garcma



     
  <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