Hello-
This is my first post on this site and I don't really know how I would know what to look for in the existing forums so I apologize in advance. I am trying to write a query that will pick a record based on the highest value in a column but I am not having any luck. Here is the data I have and what I want it to look like after the query is run.
Here is the current table I am trying to change.
tid municipality number year value 37201_005 Abbotsford 5 2019 15,333,800 10201_005 Abbotsford 5 2019 586,100 37201_006 Abbotsford 6 2019 19,004,400 10201_006 Abbotsford 6 2019 4,771,600 10201_007 Abbotsford 7 2019 2,094,400
Here is how I want the final result to look like
tid municipality number year value 37201_005 Abbotsford 5 2019 15,333,800 37201_006 Abbotsford 6 2019 19,004,400 10201_007 Abbotsford 7 2019 2,094,400
These tables are for a taxing jurisdiction in a city that is located in 2 counties. I need to pick the record (with the primary key) for the district in the County with the highest value. For example, Abbotsford has two taxing districts in two counties (numbers 5 and 6). Tax jurisdiction #5 is valued at 15,333,800 in county 1 and 586,100 in county 2. Since it is in two counties, there are two primary keys. Tax jurisdiction has the primary keys of 37201_005 and 10201_005. Since 37201_005 is valued higher than 10201_005, I want my result set to only report 37201_005. Any help will be greatly appreciated.