Ver Mensaje Individual
  #2 (permalink)  
Antiguo 18/07/2008, 02:58
quimfv
Colaborador
 
Fecha de Ingreso: marzo-2008
Ubicación: Sabadell
Mensajes: 4.897
Antigüedad: 17 años
Puntos: 574
Respuesta: Ayuda en consulta MySql

PROFESORES
id nombre
1 alex
2 luis
3 josé

CLASES
id clase Responsable1 Responsable2
1 Matematicas 1 3
2 Ciencias 3 2


Código:
Select CLASES.id, 
           CLASES.clase, 
           Resp1.nombre as Responsable1, 
           Resp2.nombre as Responsable2 
FROM (CLASES inner join PROFESORES as Resp1
          on CLASES.Responsable1=Resp1.id)
                    inner join PROFESORES as Resp2
                             on CLASES.Responsable2=Resp2.id
Quim