Hi,
I have two tables containing scores and I would like to obtain a single average score from those two tables. Is there a way to do that?
I've the sql below as follows:
Code:
sql statement
SELECT COUNT(*) AS count1, AVG(score) AS avg_score1
FROM scores1
WHERE id=3
UNION ALL SELECT COUNT(*) AS count2, AVG(score) AS avg_score2
FROM scores2
WHERE id=3
Sample table values
Table scores1
id score
3 100
3 80
Table scores2
id score
3 50
3 80
3 80
That got me the results as follows:
Code:
Count average
2 90
3 70
I was looking for a way to get the average of all the five scores. In order words, I would like the query to produce the average score of
78 (sum of all the test scores divided by 5).
Is there a way to that?
Thanks in advance
