Reputation: 673
I have a table (user table ) in which data is stored as below
| name | address |
| A | x |
| A | y |
| C | z |
and i want output like below
| name | address |
| A | x ,y |
| C | z |
I need to show these values in a user table(html view) in comma separated value(eg. address1,address2) Please help me to code it in php I am using php in backend.
Upvotes: 0
Views: 593
Reputation: 44844
You can use group_concat
as
select
name,
group_concat(address) as address
from user
group by name
Upvotes: 1