|
|
Archives of the TeradataForum
Message Posted: Tue, 01 Dec 2009 @ 20:12:58 GMT
Subj: | | Re: Incrementing count within a group of records |
|
From: | | Dieter Noeth |
David Clough wrote:
| The second column is simply generated (using ROW_NUMBER() OVER (ORDER BY DTE_DT ASC) AS DAY_NR), which will continue to increment for all
days in the calendar, and continue to increment after 1998 - as required. | |
| So, basically, I want to have a count which only changes by 1, on change of that fourth column, ordering by Year. Within 1998 it would
actually look the same as column four but when we go to 1999, that column would continue to increment, but again only when the week number
changes. | |
Sounds like ((DAY_NR - 1) / 7) + 1
Dieter
| |