I am new to sql so sorry if the answer is obvious but i couldn't find it anywhere. So i want to select the CategoryName,Description and the average price of the products that are in the same category.Below is the picture of the 2 tables involved.The problem is the description i cant find a way to show it. (There are 8 categories and every category has 1 description)
This is the code I have made so far but it has the error:
SELECT c.CategoryName,c.Description,avg(p.UnitPrice)
FROM Categories AS c
INNER JOIN Products AS p ON c.CategoryID=p.CategoryID
GROUP BY c.CategoryName
The error:
Column 'Categories.Description' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
Sorry for my bad english :/