Código SQL:
Ver originalSELECT * FROM(
SELECT '', '' AS MES,
(SELECT top 1 CASE
WHEN RTRIM(caff.SALSTERR) BETWEEN '10000' AND '19999' THEN 'LA GRAN CARACAS'
WHEN RTRIM(caff.SALSTERR) BETWEEN '20000' AND '29999' THEN 'ZULIA-FALCON'
WHEN RTRIM(caff.SALSTERR) BETWEEN '30000' AND '39999' THEN 'CENTRO'
WHEN RTRIM(caff.SALSTERR) BETWEEN '40000' AND '49999' THEN 'LOS ANDES'
WHEN RTRIM(caff.SALSTERR) BETWEEN '50000' AND '59999' THEN 'LARA - LOS LLANOS'
WHEN RTRIM(caff.SALSTERR) BETWEEN '60000' AND '69999' THEN 'ORIENTE'
WHEN RTRIM(caff.SALSTERR) = '70000' THEN 'OFICINA'
END AS ZONA FROM [SOP30200] caff WHERE caff.SALSTERR = caf.SALSTERR GROUP BY caff.SALSTERR) AS ZONA,
0 unidades_total,
CAST(isnull(((SELECT top 1 SUM(quantity) FROM [SOP30300] d
INNER JOIN [SOP30200] fIn ON d.SOPNUMBE = fIn.SOPNUMBE
WHERE fIn.VOIDSTTS<>1
AND fIn.SALSTERR = caf.SALSTERR
AND fIn.SOPTYPE='3'
AND fIn.SALSTERR BETWEEN '10000' AND '70000'
AND fIn.DOCDATE BETWEEN '01/01/2011' AND '31/12/2011'
AND d.[cmpntseq] NOT IN ('16384','32768'))),0) -
isnull(((SELECT top 1 SUM(quantity) FROM [SOP30300] d
INNER JOIN [SOP30200] fIn ON d.SOPNUMBE = fIn.SOPNUMBE
WHERE fIn.VOIDSTTS<>1
AND fIn.SALSTERR = caf.SALSTERR
AND fIn.SOPTYPE='4'
AND fIn.SALSTERR BETWEEN '10000' AND '70000'
AND fIn.DOCDATE BETWEEN '01/01/2011' AND '31/12/2011'
AND d.[cmpntseq] NOT IN ('16384','32768'))),0) AS INT) TOTAL
FROM SOP30200 caf
INNER JOIN SOP30300 de ON caf.SOPNUMBE = de.SOPNUMBE
WHERE
caf.VOIDSTTS<>'1'
AND de.[cmpntseq] NOT IN ('16384','32768')
AND (caf.SOPTYPE = '3' OR caf.SOPTYPE = '4')
AND( caf.SALSTERR BETWEEN BETWEEN '10000' AND '79999')
AND (caf.DOCDATE BETWEEN '01/01/2011' AND '31/12/2011')
GROUP BY caf.SALSTERR) AS t1 GROUP BY mes
algo asi :)