Anda perlu menggunakan PIVOT . Sesuatu seperti kueri berikut akan membantu.
SELECT CustomerNumber,
CASE WHEN [1] > 0 THEN 'Y' ELSE 'N' END [Sony],
CASE WHEN [2] > 0 THEN 'Y' ELSE 'N' END [LG],
CASE WHEN [3] > 0 THEN 'Y' ELSE 'N' END [Samsung]
FROM
(SELECT Product1, CustomerNumber
FROM Table) AS SourceTable
PIVOT
(
COUNT(Product1)
FOR Product1 IN ([1], [2], [3])
) AS PivotTable;