I'm having an issue trying to combine multiple rows in a DE. As an example, I want to take the below data (Policy Data) and combine data where the policy number is the same and display that information within an email. I've copied below as well my AMPscript.
Policy_data
Policy_Number|First_Name|Relationship
1111|Steve|Primary
1111|Mary|Spouse
1111|Dave|Child
1111|Wendy|Child
2222|Morgan|Primary
2222|Tom|Child
3333|Greg|Primary
4444|Kayla|Primary
<html>
…
Hi, your policy has the following members:
<table>
%%[
set @rows = LookupRows(Policy_Data,Policy_Number,Policy_Number)
set @rc = RowCount(@rows)
for @i = 1 TO @rc DO
set @row = Row(@rows, @i)
set @fName = Field(@row, first_name)
set @relationship = Field(@row, relationship)
]%%
<tr><td>%%=v(@fName)=%%</td><td>%%=v(@relationship)=%%</td></tr>
%%[next @r]%%
%%[end]%%
</table>
</html>
Wondering if anyone has had any similar experience?
Thanks!