prueba con esto:
Código SQL:
Ver originalSELECT SUM(valorunitario), nombre, UNDVENTA, ordimp,CANTIDAD,IVA, PRODUCTO
FROM(
SELECT
M1.PRODUCTO,
M1.NOMBRE,
[dbo].[F_MonedaMVForm]('FAC','FS','7332',M1.idmvtrade) AS ValorUnitario,
CANTIDAD,
M1.UNDVENTA,
M1.IVA,
0 AS 'ordimp'
FROM MVTrade AS M1 INNER JOIN MTMERCIA ON M1.PRODUCTO = MTMERCIA.CODIGO
WHERE NOT M1.PRODUCTO IN ('2600','2600A') AND
M1.Origen ='FAC' AND
M1.TipoDcto='FS' AND
M1.NroDcto='7332'
UNION
SELECT '2600' AS producto, 'TRANSPORTE NACIONAL DE CARGA'AS NOMBRE ,total1 AS valorunitario,total2 AS cantidad,undventa,iva,ordimp FROM(
SELECT nombre, SUM(valorunit) total1, SUM(cantidad) total2, undventa,iva,ordimp
FROM(
SELECT TB1.PRODUCTO,TB1.NOMBRE,TB1.VALORUNIT,TB1.CANTIDAD,TB1.UNDVENTA,TB1.IVA, 0 AS 'ORDIMP'
FROM MVTRADE AS TB1 JOIN MTMERCIA AS TB2 ON TB1.PRODUCTO = TB2.CODIGO
WHERE TB1.PRODUCTO IN ('2600','2600A') AND
TB1.ORIGEN = 'FAC' AND
TB1.TIPODCTO = 'FS' AND
TB1.NroDcto='7332'
GROUP BY PRODUCTO,NOMBRE,VALORUNIT,CANTIDAD,UNDVENTA,TB1.IVA
) AS t1
GROUP BY nombre, undventa,iva,ordimp
) AS t2
) AS N1 GROUP BY nombre, UNDVENTA, ordimp, IVA, CANTIDAD, PRODUCTO