This is not about last day of specific month.
I'm trying to calculate CAGR ratio (compound annual(month) growth rate). So, at the last inputed date, there's always biggest value in the specific month meaning the value only increase.
However, there's possibility that users don't input everyday(including last day of month). Therefore, I have to know which date is what user inputed most lately in the specific month.
Please refer to attached image.
I've been always happy with excellence of people in stackoverflow ! Thank you so much !
Here is the syntax for SQL Server:
In general, look up
top-n-per-group
orgreatest-n-per-group
.For a more detailed answer with other variants how to do it see: https://dba.stackexchange.com/questions/86415/retrieving-n-rows-per-group