Ver Mensaje Individual
  #16  
Antiguo 29-10-2003
Avatar de guillotmarc
guillotmarc guillotmarc is offline
Miembro
 
Registrado: may 2003
Ubicación: Huelva
Posts: 2.638
Reputación: 24
guillotmarc Va por buen camino
Hola

Supón que tienes la tabla CLIENTES, con el campo F_NACIMIENTO. Y que quieres saber los que cumplen años entre el 13 de Febrero y el 5 de Abril.

Entonces la consulta es :

Código:
select NOMBRE, APELLIDOS
from CLIENTES
where (extract(month from F_NACIMIENTO) between :MES1 + 1 and :MES2 -1) or
      (extract(month from F_NACIMIENTO) = :MES1 and extract(day from F_NACIMIENTO) >= :DIA1) or
      (extract(month from F_NACIMIENTO) = :MES2 and extract(day from F_NACIMIENTO) <= :DIA2)
Pasando los siguientes valores a los parámetros :
:MES1 = 2 (Febrero)
:MES2 = 4 (Abril)
:DIA1 = 13 (13 de Febrero)
:DIA2 = 5 (5 de Abril)

Espero que te sirva.

Saludos.
__________________
Marc Guillot (Hi ha 10 tipus de persones, els que saben binari i els que no).

Última edición por guillotmarc fecha: 29-10-2003 a las 14:35:50.
Responder Con Cita