Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: cycled order
Fred Ruffet heeft geschreven in bericht
<7ijr8h$fr4$1_at_gatekeeper.ornano.kapt.com>...
>Hi everyone,
>
>Here's a little problem. I have a table T with a key K, a name N and a
>birthdate D. I would like to do a select that would give me the list of all
>people ordered by birthdate in the year (I mean that 2-jan-1960 is after
>1-jan-1960, and also after 1-jan-1970). This list would begin on the
today's
>date.
>
>if I have this list :
>
>01-sep-1960
>15-aug-1964
>17-jan-1968
>23-may-1974
>24-nov-1974
>
>and we are the 27 april, it would return :
>
>15-aug-1964
>01-sep-1960
>24-nov-1974
>17-jan-1968
>23-may-1974
>
>Pretty, isn't it ?
>Thanks for any help,
>
>Hi Fred
I don't think you need two tables, and a plain to_char conversion will not
work.
I hope this solution will work for you:
SELECT N
,
TO_DATE(TO_CHAR(D,'DD-MON')||'-'||TO_CHAR(SYSDATE,'YYYY'),'DD-MON-YYYY')
BIRTHDAY
>SYSDATE
![]() |
![]() |