Ramco Ramco

Ramco Ramco

  • 442
  • 3.4k
  • 516.6k

Group by not working

Nov 7 2024 2:12 AM

Hi

  In below query i want to group by code,name. But when i group then it gives error DueDate is not grouped by.

SELECT T1."CardCode", T1."CardName", 

CASE
when (DAYS_BETWEEN(T0."DueDate", now()))+1 < 31
then
case
when T0."SYSCred" <> 0 then -T0."SYSCred"
else T0."SYSDeb"
end
end "0-30 days",


FROM JDT1 T0 inner join OCRD T1 on T1."CardCode" = T0."ShortName"
INNER JOIN OJDT T2 ON T2."TransId"=T0."TransId"
WHERE T1."U_MSME"  = 'Y'
AND "T1"."CardType" = 'S' 
ORDER BY T1."CardCode", T0."TaxDate"

Thanks