Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: data query question
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
------_=_NextPart_001_01C08181.F17EB0B0
Content-Type: text/plain;
charset="iso-8859-1"
> -----Original Message-----
> From: Rivera, Claudia [mailto:crivera_at_utep.edu]
> Sent: jeudi, 18. janvier 2001 10:35
> To: Multiple recipients of list ORACLE-L
> Subject: data query question
>
>
> Hello everyone:
> I have a question about a query dealing with dates.
> This is my origina query:
> select distinct to_char(question_date,'DD-MON-YYYY') from
> student_profile
> where student_id = 10;
>
>...
>
>
> I am getting the correct results, but not in the order I expected
> (chronological order). I have tried "order by question_date'
> but no success.
How about
select to_char (a.question_date, 'DD-MON-YYYY')
from
(select distinct trunc (question_date) as question_date
from student_profile
where student_id = 10
) a
order by a.question_date ;
------_=_NextPart_001_01C08181.F17EB0B0
Content-Type: text/html;
charset="iso-8859-1"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"> <META NAME="Generator" CONTENT="MS Exchange Server version 5.5.2652.35"> <TITLE>RE: data query question</TITLE> </HEAD> <BODY> <P><FONT SIZE=2>> -----Original Message-----</FONT> <BR><FONT SIZE=2>> From: Rivera, Claudia [<A HREF="mailto:crivera_at_utep.edu">mailto:crivera_at_utep.edu</A>]</FONT> <BR><FONT SIZE=2>> Sent: jeudi, 18. janvier 2001 10:35</FONT> <BR><FONT SIZE=2>> To: Multiple recipients of list ORACLE-L</FONT> <BR><FONT SIZE=2>> Subject: data query question</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> Hello everyone:</FONT> <BR><FONT SIZE=2>> I have a question about a query dealing with dates.</FONT> <BR><FONT SIZE=2>> This is my origina query:</FONT> <BR><FONT SIZE=2>> select distinct to_char(question_date,'DD-MON-YYYY') from </FONT> <BR><FONT SIZE=2>> student_profile</FONT> <BR><FONT SIZE=2>> where student_id = 10;</FONT> <BR><FONT SIZE=2>></FONT> <BR><FONT SIZE=2>>...</FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> </FONT> <BR><FONT SIZE=2>> I am getting the correct results, but not in the order I expected</FONT> <BR><FONT SIZE=2>> (chronological order). I have tried "order by question_date' </FONT> <BR><FONT SIZE=2>> but no success.</FONT></P>
<P><FONT SIZE=2>How about</FONT> <BR><FONT SIZE=2>select to_char (a.question_date, 'DD-MON-YYYY')</FONT> <BR><FONT SIZE=2>from</FONT> <BR><FONT SIZE=2> (select distinct trunc (question_date) as question_date</FONT> <BR><FONT SIZE=2> from student_profile</FONT> <BR><FONT SIZE=2> where student_id = 10</FONT> <BR><FONT SIZE=2> ) a</FONT> <BR><FONT SIZE=2>order by a.question_date ; </FONT>Received on Thu Jan 18 2001 - 13:07:46 CST
![]() |
![]() |