Error - Multiple columns are specified in an aggregated expression

  • Hi

    Error - Multiple columns are specified in an aggregated expression containing an outer reference. If an expression being aggregated contains an outer reference, then that outer reference must be the only column referenced in the expression.

      SELECT T0.DocEntry,T3.[ChapterID], Sum(T1.[LineTotal]), ISNULL((Select (case when sum(T5.RvsChrgTax)<=0 then sum(T5.TaxSum/T0.DocRate) else 0 end) From INV4 T5 Where T5.DocEntry = T0.DocEntry and T5.staType = -100 and T5.RelateType = 1),0) [CGSTAmt], ISNULL((Select (case when sum(T5.RvsChrgTax)<=0 then sum(T5.TaxSum/T0.DocRate) else 0 end) From INV4 T5 Where T5.DocEntry = T0.DocEntry and T5.staType = -110 and T5.RelateType = 1),0) [SGSTAmt],ISNULL((Select (case when sum(T5.RvsChrgTax)<=0 then sum(T5.TaxSum/T0.DocRate) else 0 end) From INV4 T5 Where T5.DocEntry = T0.DocEntry and T5.staType = -120 and T5.RelateType = 1),0) [IGSTAmt]FROM OINV T0 INNER JOIN INV1 T1 ON T0.[DocEntry] = T1.[DocEntry] INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode] INNER JOIN OCHP T3 ON T1.[HsnEntry] = T3.[AbsEntry] group by T0.DocEntry,T3.[ChapterID]

    Thanks

  • Is this a question?

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply