Re: Sql problem

From: Mike Rife <rife_at_aarlo.moffitt.usf.edu>
Date: 1995/06/09
Message-ID: <3r9oi3$76s_at_mother.usf.edu>#1/1


In article <3qiffb$e9f_at_hasle.oslonett.no>, steinas_at_ifi.uio.no (steinas) says:
>
>Hi!
>I,m trying to assemble a sql sentence selecting students who have birth-
>day between day x and day y and month between month x and month y independent
>of year.
>
>In vb this sentence works fine :
>SELECT DISTINCT studreg.studno FROM studreg WHERE day(birthday)
>BETWEEN 1 AND 15 AND month(birthday) BETWEEN 1 AND 5.
>
>Can't find an easy way to translate this to Oracle.
>What do I have to do to get this sentence to work in Oracle?
>
>Thanks in advance.
>
>Steinar

Try:

SELECT DISTINCT studreg.studno
FROM studreg
WHERE to_number(to_char(birthday,'DD')) BETWEEN 1 AND 15   AND to_number(to_char(birthday,'MM')) BETWEEN 1 AND 5;

The "to_number"'s may not be needed. Received on Fri Jun 09 1995 - 00:00:00 CEST

Original text of this message