on 11-13-2018 3:39 PM
Hola, necesitamos sumar los resutados de dos union ALL, vale decir que si la cantidad de un campos sumado en un select es 4 y en el otro es 4, que muestre solo el total, vale decir 8. He intentado de varias formas adjunto ejemplo
SELECT T0."ItemCode", SUM(T0."Quantity")
FROM (
SELECT T0."ItemCode", SUM(T0."Quantity")
FROM IGN1 T0 INNER JOIN OIGN T1 ON T0."DocEntry" = T1."DocEntry"
GROUP BY T0."ItemCode"
UNION ALL
SELECT T0."ItemCode", SUM(T0."Quantity")
FROM INV1 T0 INNER JOIN OINV T1 ON T0."DocEntry" = T1."DocEntry"
GROUP BY T0."ItemCode"
) AS "Cantidad"
GROUP BY T0."Quantity"
User | Count |
---|---|
89 | |
7 | |
6 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.