Ver Mensaje Individual
  #4 (permalink)  
Antiguo 10/10/2013, 15:54
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: Extraer informacion de dos consultas en un solo registro

prueba con:

SELECT W.base_id AS work_order_id, R.transaction_date AS last_receipt_date
FROM
work_order W
LEFT JOIN
(
SELECT TOP 1
I.workorder_base_id, I.transaction_date
FROM
inventory_trans I
WHERE
I.workorder_base_id = W.base_id
AND I.CLASS ='R'
ORDER BY
I.transaction_date DESC
) R ON (W.base_id = R.workorder_base_id)

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