Hi,
I have a problem where I have to use a function like the row_number() function but when I do my groupings I don't want to reorder the whole table.
So the result I want is in the sequence column of the table below:
sites | signal | date | sequence |
site1 | alarm | 2014-05-14 12:00 | 1 |
site1 | alarm | 2014-05-14 12:30 | 2 |
site1 | noalarm | 2014-05-14 13:00 | 1 |
site1 | noalarm | 2014-05-14 13:30 | 2 |
site1 | noalarm | 2014-05-14 14:00 | 3 |
site1 | alarm | 2014-05-14 14:30 | 1 |
site1 | alarm | 2014-05-14 15:00 | 2 |
site2 | alarm | 2014-05-14 12:00 | 3 |
site2 | noalarm | 2014-05-14 12:30 | 1 |
site2 | alarm | 2014-05-14 13:00 | 1 |
site2 | noalarm | 2014-05-14 13:30 | 1 |
site2 | noalarm | 2014-05-14 14:00 | 2 |
So to desribe what I am trying to do,I want to group by sites order by date. Then I want to sequence the signals, retaining their date ordering.
How can I do this?
Thanks