Unir 3 select
Hola, tengo un problema, tengo estas 3 select :
SELECT sum(F.Importe) AS Ventas
FROM Facturas F
WHERE F.FechaFac between (select FInicio from Ejercicio where Descripcion="Año 2002") and (select FFinal from Ejercicio where Descripcion="Año 2002")
union
SELECT sum(C.importe) as compras
FROM Compras C
WHERE C.fechafac between (select FInicio from Ejercicio where Descripcion="Año 2002") and (select FFinal from Ejercicio where Descripcion="Año 2002")
union
SELECT sum(N.importe) as compras
FROM NotasGastos N
WHERE N.fechadoc between (select FInicio from Ejercicio where Descripcion="Año 2002") and (select FFinal from Ejercicio where Descripcion="Año 2002");
lo q pasa q al poner la union , lo q hace es sacarme las 3 consulas en una sola tabla, yo quiero cada consulta en una sola tabla, con un and no rula.MUCHAS GRACIAS
SELECT sum(F.Importe) AS Ventas
FROM Facturas F
WHERE F.FechaFac between (select FInicio from Ejercicio where Descripcion="Año 2002") and (select FFinal from Ejercicio where Descripcion="Año 2002")
union
SELECT sum(C.importe) as compras
FROM Compras C
WHERE C.fechafac between (select FInicio from Ejercicio where Descripcion="Año 2002") and (select FFinal from Ejercicio where Descripcion="Año 2002")
union
SELECT sum(N.importe) as compras
FROM NotasGastos N
WHERE N.fechadoc between (select FInicio from Ejercicio where Descripcion="Año 2002") and (select FFinal from Ejercicio where Descripcion="Año 2002");
lo q pasa q al poner la union , lo q hace es sacarme las 3 consulas en una sola tabla, yo quiero cada consulta en una sola tabla, con un and no rula.MUCHAS GRACIAS
