mysql - Does anyone know how to Stuff in groups? -


this question has answer here:

i trying use stuff function in ms sql stuff info. here example:

number          value  1                 1 2                 1 3                 1 1                 2 2                 2 3                 2 1                 3 2                 3 

i stuff column 1 record display following:

value             number 1                 1,2,3 2                 1,2,3 3                 1,2 

please note there n-numbers , n-values.

you can use group_concat this. example:

select `value`, group_concat(distinct `number` order `number`) `yourtable` group `value` 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -