Rownum per day [message #643514] |
Fri, 09 October 2015 06:53 |
DirkHamburg
Messages: 5 Registered: May 2009 Location: Hamburg
|
Junior Member |
|
|
Hello!
I have a table with three columns as follows:
NAME CITY DATE
==================================
Paul Hamburg 01.10.2015 08:00
Jean Berlin 01.10.2015 12:00
Anne Munich 02.10.2015 08:00
Peter Cologne 02.10.2015 10:00
Mike Hamburg 02.10.2015 12:00
John Berlin 03.10.2015 06:00
I want to select this data and add a column, which displays the "Rownum per Day": Kind of ascending sequence per day.
Though the Rownum should be ascending depending on the datetime, the time can, but need not to be displayed in the resultset.
So, the result should look like this:
NAME CITY DATE ROW_NUM
========================================
Paul Hamburg 01.10.2015 1
Jean Berlin 01.10.2015 2
Anne Munich 02.10.2015 1 [ <-- New Day: Restart at 1]
Peter Cologne 02.10.2015 2
Mike Hamburg 02.10.2015 3
John Berlin 03.10.2015 1 [ <-- New Day: Restart at 1]
I tried to do this with count() and "group by", but as "NAME" and "CITY" are not identical per day, this wouldn't work.
Has anybody a clue how to get this result?
Thanks a lot!
Dirk
|
|
|
|
|