mysql - invalid : aggregate function or the GROUP BY clause -
hey guys can't seem figure out i'm doing wrong here. i'm quite new sql can't wrap head around this. great!
select pc.name [productcategoryname] , min(pch.standardcost) minstandardcost , avg(pch.standardcost) averagestandardcost , max(pch.standardcost) maxstandardcost productcategory pc inner join product p on (pc.productcategoryid = p.productcategoryid) inner join productcosthistory pch on ( p.productid = pch.productid) pc.name '%bike%'
you forgot group clause:
select pc.name [productcategoryname] , min(pch.standardcost) minstandardcost , avg(pch.standardcost) averagestandardcost , max(pch.standardcost) maxstandardcost productcategory pc inner join product p on (pc.productcategoryid = p.productcategoryid) inner join productcosthistory pch on ( p.productid = pch.productid) pc.name '%bike%' group pc.name
Comments
Post a Comment