Home > Mobile >  How to merge rows and form multivalued attributes for a 2 column table in MySQL
How to merge rows and form multivalued attributes for a 2 column table in MySQL

Time:04-20

I know this is terrible practice indeed, but I want to use the merged multivalued table for the GUI part of my program. Following is the thing I want.

raw table

to something like

multivalued merged table

Thanks in advance !!

CodePudding user response:

Use GROUP_CONCAT for it:

select workerid, GROUP_CONCAT(worktype)
from t
group by workerid

Look at the fiddle here.

  • Related