Using a single table with a reference and date column example below, how could I produce the out below to split the row number. The same reference on the same day should show as the same row number.
example below;
MAINFRAJOB SyncDate Row Number
7861 02/10/2019 1
7861 02/10/2019 1
7861 03/10/2019 2
1045679 25/09/2019 1
10233649 03/10/2019 1
10233652 04/10/2019 1
10233652 04/10/2019 1
10233652 06/10/2019 2
123456789 02/10/2019 1
123456789 02/10/2019 1
123456789 03/10/2019 2
123456789 04/10/2019 3
I have tried this but it is not producing the correct results;
ROW_NUMBER()over(partition by cast(ard.SyncDate as date), ard.actionref order by cast(ard.SyncDate as date) desc) AS 'RowNo'
Thanks for any guidance.