tags:

views:

26

answers:

0

My sql query looks like this:

SELECT m.original_name, m.type, m.title, m.views, 
    m.description, m.hash, AVG(mr.rating_scale5) as avg_rating_scale5 
FROM c7_media m, c7_media_ratings mr 
WHERE m.public=1 AND m.hash = mr.media_hash
GROUP BY mr.media_hash

Here I am taking average of mr.rating_sacle5 grouped by mr.media_hash

I want to ask one thing, does the AVG gives a float value: suppose if it takes avg of (5+4+4)/3. Because for me it is not giving an exact calculation.

If i run the same query using SUM, instead of AVG, I get different out puts.

or can I using something like SUM(mr.rating_scale5)/COUNT() I dont know how should I get the count for every different file? If you think AVG will not solve the purpose plz let me know how should I get the count in SUM(mr.rating_scale5)/COUNT() .