Reputation: 298
I have one table booking that have value like belw
id email
1 [email protected]
2 [email protected]
3 [email protected]
4 [email protected]
5. [email protected]
I want output like this
email id
[email protected] 1,2
[email protected] 3
[email protected] 4,5
can you suggest how i can do this.
Upvotes: 2
Views: 75
Reputation: 263703
In MysQL
, use GROUP_CONCAT
function
SELECT email, GROUP_CONCAT(id) id
FROM tableName
GROUP BY email
Upvotes: 4