WildbloodS
Technical User
In a summary query, I need to return the value that shows up the greatest number of times in a certain column of a table "TotalAssetsCalculated", for each route that is listed in a separate column "Route"
I have read that I need to calculate the "mode", and the approach I am using is cribbed from another forum
SELECT TOP 1 myTable.TotalAssetsCalculated, myTable.Route
FROM myTable
GROUP BY myTable.TotalAssetsCalculated, myTable.Route
HAVING (((myTable.TotalAssetsCalculated) Is Not Null))
ORDER BY Count(*) DESC;
I am getting the result for the highest appearing value across the whole dataset.
TotalAssetsCalculated
5,000.00
When I would like to see the values for all the routes, e.g. 2500 Anglia, 1300 Western
Any pointers gratefully received, thank you !
I have read that I need to calculate the "mode", and the approach I am using is cribbed from another forum
SELECT TOP 1 myTable.TotalAssetsCalculated, myTable.Route
FROM myTable
GROUP BY myTable.TotalAssetsCalculated, myTable.Route
HAVING (((myTable.TotalAssetsCalculated) Is Not Null))
ORDER BY Count(*) DESC;
I am getting the result for the highest appearing value across the whole dataset.
TotalAssetsCalculated
Route5,000.00
WalesWhen I would like to see the values for all the routes, e.g. 2500 Anglia, 1300 Western
Any pointers gratefully received, thank you !