• Hi All,

    Thanks for the help.

    Got it 🙂

    Below is the query:

    select * from

    (select customer

    ,sum(qty) qty1

    ,(select cast(product as varchar(max)) from datatable where customer = a1.customer for XML path(''))product

    from datatable a1

    group by customer

    )dataforpivot_table

    pivot (sum(qty1) for product in ([Mango],[Orange],[MangoOrange]))pivoted;

    Products are not fixed, they keep on changing, and even the combinations change.