Home > Net >  Consider the mean of GROUP_CONCAT values in mysql
Consider the mean of GROUP_CONCAT values in mysql

Time:02-25

I have a table like the following and I have used GROUP_CONCAT(val) as LIST_Value. I want to consider the mean of the this column and also the length of the values in each row. This AVG(GROUP_CONCAT(val)) and GROUP_CONCAT(AVG(val)) did not solve that.

I also read this link: enter image description here

CodePudding user response:

If you want the average, do it separately from the group concatenation.

SELECT point_id, date, GROUP_CONCAT(val) AS LIST_Value, AVG(val) AS AVG_Value
FROM yourTable
GROUP BY point_id, date
  • Related