从 MYSQL 查询中计算列的平均值

2022-01-09 00:00:00 average sum mysql

我有一个表,我正在尝试计算列中值的平均值.这是我的查找:

I've got a table that I am trying to calculate the average of the values in a column. Here is my lookup:

SELECT SUM(P1_Score) AS value_sum FROM tblMatches Where P1_ID LIKE $playerID

知道如何确定平均值(值的总和/总行数)吗?

Any idea how I can determine the average (sum of values / total rows)?

推荐答案

你可以使用AVG 像这样:

SELECT AVG(P1_Score)

相关文章