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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.