Ramco Ramco

Ramco Ramco

  • 431
  • 3.5k
  • 565k

Group by G/l Name

Jan 24 2025 11:03 AM

Hi

  I want below as inner query then i want to do Group by G/l Account only.

SELECT T0."TransId",T1."TransType", T1."Account",Max(T2."AcctName") As "G/l Name",Sum(T1."Debit") As "Debit", Sum(T1."Credit") As "Credit",

CASE

WHEN T1."TransType" = '13' THEN (Select max(A0."LocCode") from INV1 A0 where A0."DocEntry" = T1."CreatedBy")

WHEN T1."TransType" = '14' THEN (Select max(A0."LocCode") from RIN1 A0 where A0."DocEntry" = T1."CreatedBy")


Else '0'

END AS "Location"

 

FROM OJDT T0  INNER JOIN JDT1 T1 ON T0."TransId" = T1."TransId"

Left Join OACT T2 on T2."AcctCode" = T1."Account"

WHERE T1."BPLId" = 28

group by T0."TransId",T1."TransType",T1."Account",T1."CreatedBy"

ORDER BY T1."TransType"

Thanks