I have to retrieve all loans made within last month in each of our 50 branches.
When I run the query I get the right result but for example branch 2 has more than one value
Region Branch code Customer ID Amount of loan
1 2 78787 100
1 2 7678687 787
1 2 76768 1000
1 3 78887 1000
2 4 78787 8888
How can run a query that would return the result grouped by the region and then branch code, the count of the customer and the total sum of the amount of the loan?