I have created a query on my table like this :
WITH CTE_count
as
(
select Customer_ID as ID,Brand_Name +'-'+ cast([Sale_Amount] as nvarchar) as
brandname,ROW_NUMBER() OVER (PARTITION BY Customer_ID ORDER BY Customer_ID)
AS lineNumber
from dbo.sheet1
group by Customer_ID,Brand_Name,[Sale_Amount]
)
SELECT ID, brandname,lineNumber
FROM CTE_count;
when I run this I am getting this output:
Now How do I get 1 row per customer ID like:
cust_id order1 order2 order3 order4
100000443 AMANA-71.31 AMANA-104.4 AMANA-109.89 AMANA-104.4
How do I modify my above query
I want to do this for every ID the row is just given as example