2
Answers

Distint Location

Photo of Ramco Ramco

Ramco Ramco

3w
130
1

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

Answers (2)