Use GROUP_CONCAT () .
SELECT Type, GROUP_CONCAT(Value SEPARATOR ' ') AS Value FROM MyTable GROUP BY Type;
Ensuring word concatenation in the order you want can be difficult. GROUP_CONCAT() has an ORDER BY (see docs), but your example does not contain a column that can be used to determine the order. Reliance on storage order is not reliable.
source share