I am not knowing where to start with this query. Stuff () function is not helping to get my desired result. Any help is appreciated.
My table:
+-----+-----------+--------+
| uid | uname | host |
+-----+-----------+--------+
| 1 | testuser | host 1 |
| 2 | testuser | host 2 |
| 3 | testuser2 | host 3 |
| 4 | testuser2 | host 4 |
+-----+-----------+--------+
expected output:
+-----+-----------+--------+---------------+
| uid | uname | host | combined host |
+-----+-----------+--------+---------------+
| 1 | testuser | host 1 | host1,host2 |
| 2 | testuser | host 2 | host1,host2 |
| 3 | testuser2 | host 3 | host3,host4 |
| 4 | testuser2 | host 4 | host3,host4 |
+-----+-----------+--------+---------------+