judge column text and combine cells

I need to add html for my product.

Each html represent an image to be placed for the product page.
Each product has several images.
I wish to combine all image html for each product.

For example:
image description
Column A is product no. There are three products with three different numbers.
Column B is html which present different images.
Column C is the result I wish to get. I just use “concatenate” function to get what I want.
But I really hope to know any better way to automatically do the job.

I don’t know how to make system to judge the same product no and combine the column accordingly.

Try this: type to cell C2

{=IF(A2=A1;"";TEXTJOIN("";1;IF(A:A=A2;B:B;"")))}

(Finish entering the formula with the key combination Shift + Control + Enter, copy the resulting cell and paste it into the entire column C)