hey,
i have a slowly changing dimension and i want to get the last
different occurrence for each row.
Sample Data
the field LAST_VALUE is the one i'm looking for.
ID START_DATE END_DATE VALUE LAST_VALUE
1 01/01/2000 01/02/2000 X null
1 01/02/2000 01/03/2000 X null
1 01/03/2000 01/04/2000 Y X
1 01/04/2000 01/05/2000 Y X
1 01/05/2000 01/06/2000 X Y
1 01/06/2000 01/07/2000 X Y
1 01/07/2000 01/08/2000 Z X
1 01/08/2000 01/09/2000 Q Z
i want to try and do that without three sub selects.
i've tried analytic functions but lag brings me the last occurrence which is not necessarily different.
thanks.