I have data in my database that I need to group by and find the max value based on frequency. For example I want to select both the ID and the Country with the maximum NumberOfVisits per ID.
sample data:
ID | Country | NumberOfVisits |
---|---|---|
1 | US | 5 |
2 | UK | 7 |
1 | UAE | 10 |
The Output I am expecting is :
ID | Country |
---|---|
1 | UAE |
2 | UK |