mysql - SQL idea for a query -
i have kind of table
id-----categoryid-----price 1---------1-----------200 2---------1-----------300 3---------2-----------150 4---------2-----------100
i need sql query can average of elements category id. results should like:
categoryid----------avg_price 1-------------------250 2-------------------175
i have not been able think through..
select categoryid, avg(price) table group categoryid
Comments
Post a Comment