Ramco Ramco

Ramco Ramco

  • 1.4k
  • 702
  • 41.9k

Error-Each GROUP BY expression must contain at least one column that

Dec 18 2021 8:03 AM

Hi

   Error - Each GROUP BY expression must contain at least one column that is not an outer reference.

SELECT 
    T1.U_VendCode,T1.U_CabNo,T1.U_VendName as "Vendor Name",Count(*),
    (Select Count(*) from [tbl2] where T1.U_APDE <> 'N' 
    group by T1.U_VendCode,T1.U_CabNo,T1.U_VendName,T1.U_Custcode,T1.U_Custname,T1.U_APDE,T1.U_ARDE,T1.U_ItemCode),
    T1.U_CustCode as "Cust Code",T1.U_CustName as "Cust Name",T1.U_ItemCode
    FROM [tbl1] T0                        
    inner join [tbl2] T1 on T0.Docentry = T1.DocEntry
    where  (T1.U_ItemCode is not null) and (T0.U_DATE BETWEEN '2021-03-01' and '2021-03-31' )
    and T1.U_CustCode = 'A01'
    group by T1.U_VendCode,T1.U_CabNo,T1.U_VendName,T1.U_Custcode,T1.U_Custname,T1.U_APDE,T1.U_ARDE,T1.U_ItemCode

Thanks


Answers (2)