Ver Mensaje Individual
  #7 (permalink)  
Antiguo 03/11/2003, 05:12
Avatar de Vice
Vice
 
Fecha de Ingreso: agosto-2003
Mensajes: 613
Antigüedad: 20 años, 8 meses
Puntos: 2
Hola.
Lo que quieres hacer se puede hacer bastante sencillo con un sql, pues aunque las consultas son todas sobre la misma tabla, tú puedes cruzar una tabla consigo misma de la siguiente manera:
Código PHP:
select a.COLOR
from MIS_COLORES_FAVORITOS a
MIS_COLORES_FAVORITOS B
 where a
.MIS_GUSTOS 'Pepe' and b.MIS_GUSTOS="Rosa"
  
and a.COLOR=b.COLOR 
Esta select te devuelve los colores que tienen en común Rosa y Pepe.
Si quieres puede hacerlo definiendo el inner join:
Código PHP:
select a.COLOR
from MIS_COLORES_FAVORITOS a
inner join MIS_COLORES_FAVORITOS B  on a.COLOR=b.COLOR
 where a
.MIS_GUSTOS 'Pepe' and b.MIS_GUSTOS="Rosa" 
Un saludo.