Hello!
I have the first two columns of the following data in my table (let's call it storico):
IdZona Inizio number
24 1985-03-01 1
81 1988-12-01 2
21 1990-01-01 3
21 1992-02-01 3
79 1996-01-01 4
21 1996-11-01 5
21 1999-02-01 5
21 2005-01-01 5
21 2008-12-01 5
So the data has to be shown ordered by Date ("inizio"). For each date there is a certain value of IdZona. What I want to know is how to get the third column calculated by SQL Server 2008 R2. The Number has to increase each time another value in column idZona is detected. When going back to a value already given of idZona (p.e. se line 1996-11-01) the [number] value must not report a value already shown, but increase another time.
Hope, the task is clear.
Thanks in advance,
Klaus