Jump to content

[SOLVED] GROUP BY, ORDER BY, average and sum?


katie77

Recommended Posts

Hi there,

 

The code below is not working, and I wondered if anyone could tell me why?

Does it matter that I'm using the occupation column in the WHERE statement without selecting it?  Occupation is in the original table.

 

select 	software_name, software_img, software_company, software_platforms,
		cost_pound,	cost_dollar, cost_euro,
		avg(rating_modelling) as rating_modelling, avg(rating_texturing) as rating_texturing, 
		avg(rating_rendering) as rating_rendering, avg(rating_animating) as rating_animating, 
		avg(rating_stability) as rating_stability, avg(rating_speed) as rating_speed, 
		avg(rating_support) as rating_support, avg(rating_value) as rating_value, 
		avg(rating_overall) as rating_overall, sum(total_votes) as total_votes  
from software 
		WHERE occupation = 'student'
                        ORDER BY rating_overall DESC
		GROUP BY software_name, software_img, software_company, software_platforms, 
		cost_pound, cost_dollar, cost_euro;

 

Many thanks,

 

Katie

Link to comment
https://forums.phpfreaks.com/topic/79285-solved-group-by-order-by-average-and-sum/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.