Sample Table:
ID Product
1 Survey
1 Policy
1 Invoice
2 Invoice
2 Survey
3 Policy
3 Invoice
What I would like to end up with is a table w/ 3 rows (one for each of the ids) w/ the products in a comma separated list:
ID Product
1 Survey, Policy, Invoice
2 Invoice, Survey
3 Policy, Invoice
I was able to do this w/ a User Defined Scalar Function, but it is very slow, I believe the more proper solution would to be a cursor, but that is where I need the help
Not sure about the speed vs UDF or cursor but you can give this a try: