Código SQL:
Ver originalCREATE TABLE #temp
(
docto INT,
fecha datetime,
cantidad INT
)
INSERT INTO #temp VALUES (1,'2014-08-04',21)
INSERT INTO #temp VALUES (2,'2014-08-06',13)
INSERT INTO #temp VALUES (3,'2014-08-07',15)
INSERT INTO #temp VALUES (4,'2014-08-11',02)
INSERT INTO #temp VALUES (5,'2014-08-22',77)
INSERT INTO #temp VALUES (6,'2014-08-25',21)
INSERT INTO #temp VALUES (7,'2014-08-27',17)
CREATE TABLE #temp2
(
docto INT,
fecha datetime,
cantidad INT
)
INSERT INTO #temp2 VALUES (1,'2014-08-05',21)
INSERT INTO #temp2 VALUES (2,'2014-08-25',13)
SELECT docto,fecha,cantidad AS salida,0 AS entrada FROM #temp
UNION
SELECT docto,fecha,0 AS salida,cantidad AS entrada FROM #temp2
algo asi??