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

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -