Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/11/2010, 10:24
Avatar de robertgustavo
robertgustavo
 
Fecha de Ingreso: marzo-2008
Ubicación: Camaná - Arequipa
Mensajes: 213
Antigüedad: 16 años, 1 mes
Puntos: 4
Left outer join access - ADO.NET

Hola hace un tiempo hize una consulta en sql expreess, y ahora necesito pasarla a access, segun le leido left outer join no funciona en access. ayuda please, este es el codigo

Cita:
@FechaInicio datetime,
@FechaFin datetime
As
Select P.Id
,P.descripcion
,P.categoria
,P.marca
,P.StockInicial
,isnull(J.Entrada,0)+ isnull(M.DevCliente,0)+ isnull(B.DevProveedor,0) Entradas
,isnull(S.Salida,0) Salidas
,isnull(J.Entrada,0)+ isnull(M.DevCliente,0)+ isnull(B.DevProveedor,0)+isnull(P.StockInicial,0)-isnull(S.Salida,0) SaldoFinal
From Productos P
Left outer join
(SELECT IDProducto,sum(Cantidad) as Salida
from DetalleVenta
Where fecha Between @FechaInicio and @FechaFin
Group by IdProducto) S
On P.Id = S.IdProducto
Left outer join
(SELECT IdProducto,sum(Cantidad) as Entrada
from DetalleCompra
Where fecha Between @FechaInicio and @FechaFin
Group by IdProducto) J
On P.Id = J.IdProducto
/*Aca de la devolucion de Clientes*/
Left outer join
(SELECT IDProducto,sum(Cantidad) as DevCliente
from DetalleDevolucion
Where fecha Between @FechaInicio and @FechaFin
Group by IdProducto) M
On P.Id = M.IdProducto
/*Aca de la devolucion de Proveedores*/
Left outer join
(SELECT IDProducto,sum(Cantidad) as DevProveedor
from DetalleDevolucionProveedores
Where fecha Between @FechaInicio and @FechaFin
Group by IdProducto) B
On P.Id = B.IdProducto
__________________
Soluciones basadas en .NET Framework y SQL Server