I have created a temp table, the idea being that I want to loop through it, match all records with the same email address and then populate a string, which will go in to an email, then drop the table. This will be run as a stored procedure.
I've used a cursor that first grabbed all the unique email addresses and then coalesce the records but with potentially 100k-500k records performance won't be acceptable, and I know there must be a far more efficient way of doing it.
Example data (apologies, don't know how to format it properly)
#temptable
temp_email, temp_string
[email protected] string1
[email protected] string2
[email protected] string3
[email protected] string4
[email protected] string5
I then want to populate another table with this data
emailto... emailbody
[email protected] 'string1<br / > string2'
[email protected] 'string3<br / > string4'
[email protected] 'string5'
Thank you.