I have part of a query here:
ROW_NUMBER() OVER(PARTITION BY ddr.number ORDER BY ddr.date) row_number,
To return the row number on each row as below
How could I adjust the query to return the following:
| date | ddr_number | number | Row Number |
|---|---|---|---|
| 05/09/2022 | HMCJCKIB5T6EF63RGLH1R60N2400QBV9 | 757824084 | 5 |
| 05/09/2022 | HMCJCKIB5T6EF63RGLH1R60N2400QBV9 | 757824084 | 5 |
| 05/09/2022 | HMCJCKIB5T6EF63RGLH1R60N2400QBV9 | 757824084 | 5 |
| 05/09/2022 | HMCJCKIB5T6EF63RGLH1R60N2400QBV9 | 757824084 | 5 |
| 05/09/2022 | HMCJCKIB5T6EF63RGLH1R60N2400QBV9 | 757824084 | 5 |
I want to return the max row number on every row, how can I do this without selecting max from a subquery etc, is there a way to do this by simply adjusting the window function?
Thanks!
