Invalid use of group function For this query, I'm trying to average the price of all orders for a given restaurant. It works perfectly fine for the sum:

SELECT r.restaurantName, SUM(m.price) AS 'totalPrice w/o Tax', SUM(m.price *1.10) AS 'totalPrice w/ Tax'
FROM Restaurant r
INNER JOIN MenuItem m
ON m.restaurantNo = r.restaurantID
INNER JOIN FoodOrder f
ON m.itemNo = f.itemNo
WHERE r.restaurantName = "Eureka Pizza";


But when I try to average that I get an error:

SELECT r.restaurantName, SUM(m.price) AS 'totalPrice w/o Tax', SUM(m.price *1.10) AS 'totalPrice w/ Tax', AVG(SUM(m.price)) AS 'avg base price'
FROM Restaurant r
INNER JOIN MenuItem m
ON m.restaurantNo = r.restaurantID
INNER JOIN FoodOrder f
ON m.itemNo = f.itemNo
WHERE r.restaurantName = "Eureka Pizza";
You just need AVG(m.price) in your select list.