![]() |
|
Archives of the TeradataForumMessage Posted: Tue, 21 Mar 2006 @ 19:52:29 GMT
Hi, you need some sort criteria. Say it would be "start_date" Try:
Select ( case when col5 = prev_col5 then 1 else 0 end ) +
( case when col6 = prev_col6 then 1 else 0 end )
>From
(
Select col5
, max( col5 ) over ( order by start_date rows between 1 preceding and 1
preceding ) as prev_col5
, col6
, max( col6 ) over ( order by start_date rows between 1 preceding and 1
preceding ) as prev_col5
>From table
) t01;
Hope this helps, Christian Schiefer makeITdone IT Services
| ||||||||||||||||||||||||||||||||||||||||||||||||
| | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
|
| ||||||||||||||||||||||||||||||||||||||||||||||||
| Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
| Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||