Ver Mensaje Individual
  #8 (permalink)  
Antiguo 07/10/2005, 08:21
Avatar de Jose_minglein2
Jose_minglein2
 
Fecha de Ingreso: noviembre-2004
Mensajes: 2.344
Antigüedad: 19 años, 5 meses
Puntos: 8
Pues claro hombre:

Código:
SELECT P.provider_id, P.company_name, P.country, P.medical_speciality,
C.status_2, C.provider_call_log_id
 from provider P inner join provider_call_log C on P.Provider_id=C.Provider_Id WHERE P.active='prospect' AND 
C.provider_call_log_id = (SELECT Max(provider_call_log_id)
from provider_call_log where provider_id=P.Provider_Id)
UNION
SELECT P.provider_id, P.company_name, P.country, P.medical_speciality,
NULL AS status_2, NULL as provider_call_log_id
 from provider P WHERE P.active='prospect' AND 
Provider_id not in (SELECT Distinct(Provider_id) from Provider_call_Log)
Si no te funciona así, pon ambos selects entre parentesis.

Suerte.