Below is my query that I am using:
SELECT
County,
Code,
Sum(PaidAmount) AS TotalPaid
FROM
Counties
GROUP BY
County,
Code
It returns the set:
County Code TotalPaid
Brown 99 210.21
Lyon 73 322.22
Lyon 88 533.22
Lincoln 22 223.21
What I am looking for is a query that will return the rows that show the County and the Code for the Max TotalPaid for each County. An example of the result set that I need is shown below (notice that Lyon, 73 is removed since Lyon, 88 has a higher TotalPaid amount):
County Code TotalPaid
Brown 99 210.21
Lyon 88 533.22
Lincoln 22 223.21