MySQL Average of column where there are greater than 5 rows
Translations
Englishالعربية
български
català
中文
čeština
dansk
Nederlands
eesti
suomi
français
Deutsch
Ελληνικά
עברית
हिंदी
magyar
Bahasa Indonesia
italiano
日本語
한국어
latviešu
lietuvių
norsk
polski
Português
română
русский
slovenčina
slovenski
español
svenska
ไทย
Türkçe
українська
Tiếng Việt
Is there any way to use MySQL to only return an average if there are more than X rows?
I am currently using the following query:
SELECT round(AVG(a_points),1) as a from points where user_id=X
Can this be done in MySQL or do I have to do a row count first then execute this statement?
The table contains
user_id a_points b_points
So a user could have lots of b_points but only 4 a_points and I wouldn't want to average at that point.
This question and answers originated from www.stackoverflow.com
Question by Lloyd S (8/1/2011 3:39:36 PM)
Answer |