Skip to content
Advertisement

SQL Pivot String Data

I have a tables in SQL Server: Product

Product Table:

This is the output that I need:

An ImageID can have maximum 3 ProductID It is not necessary that all ImageID will have 3 products [eg. ImageID=3]

Advertisement

Answer

Your were very close, you just needed to incorporate Row_Number()

Example

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement