|
|
Archives of the TeradataForum
Message Posted: Wed, 25 May 2011 @ 10:10:25 GMT
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
| |