Hello, let's say there is such a table in mysql 
How to use PHP to bring it to the browser in this form
I know how to sum up the numerical values, but I can’t catch up with a few lines into one. Tell me please
To concatenate strings when grouping, mysql has a function GROUP_CONCAT()
The command syntax is as follows:
GROUP_CONCAT([DISTINCT] expr [,expr ...] [ORDER BY {unsigned_integer | col_name | expr} [ASC | DESC] [,col_name ...]] [SEPARATOR str_val]) That is, to get a list of names without repeating alphabetically separated by a space (comma by default), you should write a query of the form:
SELECT GROUP_CONCAT(DISTINCT name ORDER BY name ASC SEPARATOR ' ') By default, the maximum length of the string to be combined is 1024 and is set by the variable group_concat_max_len
Source: https://ru.stackoverflow.com/questions/748011/
All Articles
select group_concat(name SEPARATOR ' '), sum(val1), sum(val2) from table1- teran