Hi
I have below code and i want to get distinct location using stuff_agg in sql . Below is the Sql query
SELECT T1."TransId",( Select STRING_AGG(A0."LocCode",',') from PCH1 A0 inner join OPCH A1 on A0."DocEntry" = A1."DocEntry" and A1."BPLId" = T1."BPLId" inner join VPM2 A2 on A2."DocNum" = T1."CreatedBy" and A0."DocEntry" = A2."DocEntry") As "Location"
from JDT1 T1
where T1."TransId" = 1897692
Thanks