I want to combine rows when they have same date and Item# while aggregating received QTY and Outstanding QTY. Also, PO# should be combined with “, “.
Please refer to the image or table below.
Thank you in advance!!
This is my SQL Query...
SELECT *
from [mason01].[dbo].[po_east] as t1
inner join (select distinct [Date],[ITEMNO],[PONUMBER],[LOCATION],[Received],[Outstanding]
FROM [mason01].[dbo].[po_east] group by [Date], [ITEMNO],[PONUMBER],[LOCATION],[Received],[Outstanding]) as t2
on t1.Date=t2.Date and t1.ITEMNO=t2.ITEMNO
Date ITEMNO PONUMBER LOCATION Received Outstanding
4/22/2018 MA1005 SON18497 SF 50 50
4/22/2018 MA1005 SON18562 SF 300 0
Date ITEMNO PONUMBER LOCATION Received Outstanding
4/22/2018 MA1005 SON18497, SON18562 SF 350 50
Refer this image: