I have a sql table like this one:
id email links
1 test1@test.com www.link1.com
2 test2@test.com www.link2.com
3 test3@test.com www.link3.com
4 test1@test.com www.link4.com
5 test2@test.com www.link5.com
6 test2@test.com www.link6.com
7 test4@test.com www.link7.com
8 test5@test.com www.link8.com
9 test6@test.com www.llink9.com
10 test2@test.com www.link10.com
And I need to find a query that will give this kind of result:
email link1 link2 link3 link4
test1@zendata.ca www.link1.com www.link4.com
test2@zendata.ca www.link2.com www.link5.com www.link6.com www.link10.com
test3@zendata.ca www.link3.com
test4@zendata.ca www.link7.com
test5@zendata.ca www.link8.com
test6@zendata.ca www.llink9.com
Unique emails with each of the associated links…
Thank you if you can solve this problem,
This is much more easily done with
GROUP_CONCAT()and then processed in application code to split up the resultant string:Example results:
This assumes, of course, that you will be processing this result set with some application code in some other programming language.