Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Consider the mean of GROUP_CONCAT values in mysql

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: MySQL pivot row into dynamic number of columns But, I could not find the answer for my problem.

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading