I need to change the format of the output in following format:
43659 709, 711, 712, 714, 716, 771, 772, 773, 774, 776, 777, 778
43660 758, 762
43661 708, 711, 712, 715, 716, 741, 742, 743, 745, 747, 773, 775, 776, 777, 778
How do I use Pivot/Unpivot for the following query? Or is there any other way to do it?
Select Distinct ProductID, SalesOrderID
from Sales.SalesOrderDetail
Group By SalesOrderID, ProductID
Order By SalesOrderID, ProductID