Ver Mensaje Individual
  #2  
Antiguo 07-10-2011
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Reputación: 21
gluglu Va por buen camino
No sé si será eficiente o no .... pero esto parece que funciona :

Código SQL [-]
Select T1.CLAVE, T2.SUBCLAVE
from TABLA1 T1
left join (Select CLAVE, SUBCLAVE
           from TABLA2
             union
           Select CLAVE, 0 as SUBCLAVE
           from (Select CLAVE,
                 from TABLA2
                 group by CLAVE)) T2
on T1.CLAVE = T2.CLAVE

__________________
Piensa siempre en positivo !
Responder Con Cita