Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/10/2006, 09:02
zyon
 
Fecha de Ingreso: septiembre-2005
Mensajes: 1.289
Antigüedad: 19 años, 5 meses
Puntos: 3
Pregunta Ayuda con una consulta...

Que tal amigos, necesito hacer una consulta pero no me sale, el caso seria este:

Tabla

|PLANTILLA |CLAVE |R |C |VALOR

|Plantilla a |10Seccion1 |5 |2 |MANTENIMIENTO
|Plantilla a |10Seccion1 |2 |4 |29/07/2006
|Plantilla a |11Seccion1 |5 |2 |CAPACITACION
|Plantilla a |11Seccion1 |2 |4 |29/08/2006
|Plantilla a |12Seccion1 |5 |2 |ASESORIAS
|Plantilla a |12Seccion1 |2 |4 |29/09/2006
|Plantilla a |10Seccion1 |5 |2 |MANTENIMIENTO
|Plantilla a |10Seccion1 |2 |4 |29/10/2006

Lo que quiero hacer es seleccionar los valores sin repetir del campo VALOR(lo que es MANTENIMIENTO, ASESORIAS, etc.), pero condicionando que el año, que esta en otra fila de la tabla y que sea de la misma CLAVE, corresponda a uno q yo le determine, no se si me explique, quise hacer esto:

Código HTML:
select distinct valor from Tabla
where valor in (Select valor from Table where 
 CLAVE like '%Seccion1' and R='5' and C='2'
  and plantilla='Plantilla a'
and valor in (Select valor from Tabla
 where CLAVE like '%Seccion1' 
     and R='2' and C='4'
      and plantilla='Plantilla a' and valor like '%2006'))
No se si me explique, si no es asi diganmelo y tratare de plantearlo mejor...
__________________
Wow! No se que decir...