I have a dataset as follows
name date x 2014-01-01 x 2014-01-02 y 2014-01-03 x 2014-01-04
and I'm trying to get this result
name date row_num x 2014-01-01 1 x 2014-01-02 2 y 2014-01-03 1 x 2014-01-04 1
I tried to run this request
select name, date, row_number () over (partition by name order by date) as row_num from myTBL
but unfortunately I get this result
name date row_num x 2014-01-01 1 x 2014-01-02 2 y 2014-01-03 1 x 2014-01-04 3
Please, help.
source share