Ver Mensaje Individual
  #8 (permalink)  
Antiguo 28/05/2013, 11:16
Avatar de Libras
Libras
Colaborador
 
Fecha de Ingreso: agosto-2006
Ubicación: En la hermosa perla de occidente
Mensajes: 7.412
Antigüedad: 17 años, 8 meses
Puntos: 774
Respuesta: Error al usar RIGHT JOIN

si usas la misma sentencia porque no haces esto:


Código SQL:
Ver original
  1. SELECT D.Art_id, D.Detalle_Cantidad, D.Detalle_Costo_Unitario , CASE isnull(O.Fecha_Desde,0) WHEN 0 THEN 0 ELSE 3 END Valor
  2.                        FROM   Orden_Loc_Detalle D WITH(Nolock)
  3.                        RIGHT OUTER JOIN Com_Ofertas  O WITH(NoLock)
  4.                        ON O.Emp_id = D.Emp_id AND O.Suc_id = D.Suc_id AND O.Art_id = D.Art_id
  5.                        WHERE  D.Emp_id   = 1
  6.                        AND    D.Orden_id = 29279
  7.                        AND    D.Suc_id   = 2
  8.                        AND    D.Detalle_Envio_Prov = 'si'
  9.                        AND    O.Prov_id  = 316  
  10.                        AND    CONVERT(VARCHAR(10),Getdate(),112)     BETWEEN
  11.                            CONVERT(VARCHAR(10),O.Fecha_Desde,112) AND
  12.                            CONVERT(VARCHAR(10),O.Fecha_Hasta,112)
  13.                        ORDER BY Valor

saludos!
__________________
What does an execution plan say to t-sql query? Go f**k yourself, if you are not happy with me