Ver Mensaje Individual
  #4  
Antiguo 21-11-2006
jalejandro0211 jalejandro0211 is offline
Registrado
 
Registrado: nov 2006
Posts: 2
Reputación: 0
jalejandro0211 Va por buen camino
Sentencia Correcta

Gracias a todos por las respuestas, me funciono con:

You need a simple join:

Código SQL [-]
Select Tbl1.Cedula
From
(SELECT CEDULA, COUNT(CEDULA) AS CONT 
FROM MATRIX_ODONTOGRAMA 
GROUP BY CEDULA HAVING CONT = 3) as Tbl1
Join
(SELECT matrix_odontograma.cedula as Cedula, primer_nombre as Nombre,
primer_apellido as Apellido, genero as Genero, 
fecha_nacimiento as FechaNacimiento 
FROM matrix_odontograma, pacientes 
where (matrix_odontograma.cedula = pacientes.cedula) AND
(idDientes = 1 AND Superficie = 1 AND nombre_enfermedad = 'Caries'
or idDientes = 2 AND Superficie = 6 AND nombre_enfermedad = 'PPR' 
or idDientes = 3 AND Superficie = 6 AND nombre_enfermedad = 'Extraido' ) 
group by cedula 
having count(matrix_odontograma.cedula) between 3 and 3) as tbl2
on tbl1.Cedula = tbl2.Cedula
Responder Con Cita