Column 'ORCT.CardCode' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. RRS feed

  • Question

  • User-797751191 posted


    Declare @SalesPerson nvarchar(10),@BpName nvarchar(100),@DocDate Date,@Amount decimal(10,2)
    DECLARE insert_cursor CURSOR FOR 
    SELECT T2.[SlpName],T1.[CardName],T0.[DocDate],Sum(T0.[NoDocSum]),
    (Select Sum([NoDocSum]) FROM ORCT where CardCode = (Select CardCode from OCRD where CardCode = T0.CardCode)
    FROM ORCT T0  
    INNER JOIN OCRD T1 ON T0.[CardCode]=T1.[CardCode]
    INNER JOIN OSLP T2 ON T1.[SlpCode] = T2.[SlpCode] 
    where docdate between @frDate and @toDate
    group by T0.[DocDate],T2.[SlpName],T1.[CardName]
    order by T2.[SlpName],T1.[CardName]


    Tuesday, July 21, 2020 6:15 AM


  • User-797751191 posted


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, July 21, 2020 7:00 AM