Kindly help with the following T-SQL query. The data used is that of us_counties_2010
.
SELECT
SUM(P0010001) AS 'County Sum',
ROUND(AVG(P0010001),0) AS 'County Average',
PERCENTILE_CONT(0.5)
WITHIN GROUP (ORDER BY P0010001) OVER() AS 'County Median'
FROM
USCounties;
Messages
Column 'USCounties.P0010001' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
I tried executing multiple times by making minor alterations.