Error 260 query

BUEN DIA

tengo la siguiente consulta unida de dos tablas pero me sale el siguiente error. pero si genero la consulta por aparte si me ejecuta bien se que dice algo de price pero lo revise y nada agradezco la colaboracion si me pueden ayudar
gracias

error
1).

[SAP AG][LIBODBCHDB DLL][HDBODBC] General error;260 invalid column name: The column 'T1.Price' is invalid in the select list because the GROUP BY clause or an aggregation function does not contain it: line 1 col 193  'Alertas recibidas' (OAIB) (at p

SELECT 'FT' "Tipo", T0."DocDate", T4."SlpName" "VENDEDOR",  T0."CardCode", T0."CardName", T5."City", T0."DocNum", T0."DocEntry", T3."ItmsGrpNam", T2."ItemName", SUM(T1."Quantity") "Cantidad", T1."Price" "PRECIO VENTA", T1."Currency", T1."Rate", SUM(T1."LineTotal") "TOTAL VENTA ML", 
SUM(T1."TotalSumSy") "TOTAL VENTA LINEA USD", SUM(T1."GrssProfit") "GANANCIA BRUTA" , SUM(T1."GrssProfFC") "GANANCIA BRUTA USD",
AVG(T1."TotalSumSy"/T1."Quantity") "PRECIO VENTA USD",
AVG(CASE WHEN T1."LineTotal" = 0 THEN NULL ELSE -T1."GrssProfit"/-T1."LineTotal"*100 END) "PROMEDIO MARGEN" 



FROM "OINV"  T0 INNER JOIN "INV1"  T1 ON T0."DocEntry" = T1."DocEntry" INNER JOIN "OITM"  T2 ON T1."ItemCode" = T2."ItemCode" INNER JOIN "OITB"  T3 ON T2."ItmsGrpCod" = T3."ItmsGrpCod" INNER JOIN "OSLP"  T4 ON T0."SlpCode" = T4."SlpCode" INNER JOIN "OCRD"  T5 ON T0."CardCode" = T5."CardCode" WHERE T0."DocDate" BETWEEN [%0] AND [%1] AND  T0."CANCELED" = 'N' 




UNION ALL

SELECT 'NC' "Tipo", T0."DocDate", T4."SlpName" "VENDEDOR",  T0."CardCode", T0."CardName", T5."City", T0."DocNum", T0."DocEntry", T3."ItmsGrpNam", T2."ItemName", SUM(-T1."Quantity") "Cantidad", -T1."Price" "PRECIO VENTA", T1."Currency", T1."Rate", SUM(-T1."LineTotal") "TOTAL VENTA ML", 
SUM(-T1."TotalSumSy") "TOTAL VENTA LINEA USD", SUM(-T1."GrssProfit") "GANANCIA BRUTA" , SUM(-T1."GrssProfFC") "GANANCIA BRUTA USD",
AVG(T1."TotalSumSy"/-T1."Quantity") "PRECIO VENTA USD",
AVG(CASE WHEN -T1."LineTotal" = 0 THEN NULL ELSE -T1."GrssProfit"/-T1."LineTotal"*-100 END) "PROMEDIO MARGEN" 



FROM "ORIN"  T0 INNER JOIN "RIN1"  T1 ON T0."DocEntry" = T1."DocEntry" INNER JOIN "OITM"  T2 ON T1."ItemCode" = T2."ItemCode" INNER JOIN "OITB"  T3 ON T2."ItmsGrpCod" = T3."ItmsGrpCod" INNER JOIN "OSLP"  T4 ON T0."SlpCode" = T4."SlpCode" INNER JOIN "OCRD"  T5 ON T0."CardCode" = T5."CardCode" WHERE T0."DocDate" BETWEEN [%0] AND [%1] AND  T0."CANCELED" = 'N' 


GROUP BY T0."DocDate", T4."SlpName", T0."CardCode", T0."CardName", T5."City", T0."DocNum", T0."DocEntry", T3."ItmsGrpNam", T2."ItemName", T1."Price", T1."Currency", T1."Rate"

En el query antes del UNION ALL tambien debe poner el group by

Hola buenos días.

Formatear adecuadamente el texto sql, por favor.

Al escribir el mensaje os aparece en el editor una serie de iconos para hacerlo adecuadamente, gracias.

BUEN DIA

muchas gracias ya me funciono

Este tema se cerró automáticamente 7 días después de la última publicación. No se permiten nuevas respuestas.