MySQL Concat Columns with Comma Example

MySQL

Nicesnippets

27-01-2022


Hi Friends,

I am going to explain you example of MySQL concat columns with comma. You will learn how to how to concatenate two columns in MySQL with comma. I would like to how to MySQL concat columns with comma. This article will give you simple example of how to concatenate columns with comma in SQL query.

We will use get search concat with comma in MySQL. You can understand a concept of search how to concat columns with comma in MySQL server.

You can see both example of how to MySQL concat with comma.

Let's see bellow example:

Table: users


Table: users_role

Solution SQL Query:

SELECT

users.id,

users.first_name,

users.last_name,

users.email,

GROUP_CONCAT(users_role.name) AS role_list

FROM `users`

INNER JOIN users_role ON users_role.user_id = users.id

GROUP BY users.id

Output:

I hope it will help you...