right now I am getting duplicates on an ID because it has unique attributes. Example and query below


Select distinct ID, Company
from Order
ID Company
1100 Fisher
1100 Nesses
1101 Denny's
1101 Labor Inc

I would like to have a table where the unique Company values are listed in one column and which will remove duplicates on ID


ID Company
1100 Fisher, Nesses
1101 Denny's, Labor Inc

1 Answer 1

SELECT id, GROUP_CONCAT(company SEPARATOR ", ") AS companies
    FROM `order`
    GROUP BY id

Not the answer you're looking for? Browse other questions tagged or ask your own question.