Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Problem with order when selecting

Re: Problem with order when selecting

From: Tony <andrewst_at_onetel.net.uk>
Date: 8 Jul 2004 02:45:56 -0700
Message-ID: <c0e3f26e.0407080145.5b23ca19@posting.google.com>


"Jim Kennedy" <kennedy-downwithspammersfamily_at_attbi.net> wrote in message news:<xX_Gc.42044$IQ4.41187_at_attbi_s02>...
> "Roman Klesel" <rupa_at_firemail.de> wrote in message
> news:slrnceotkp.pau.rupa_at_gemini.office.noris.de...
> >
> > Dear SQL hackers,
> >
> > I would like to do the following:
> >
> > select
> > to_char(first_time),
> > count(first_time)
> > from v$log_history
> > group by to_char(first_time)
> > order by first_time
> >
> > Unfortunately this does not work.
> > However when I:
> >
> > order by to_char(first_time)
> >
> > I don't get the order I want.
> >
> > Can some one please show me how this is ment to work!
> >
> > Thanks in advance.
> >
> > Roman Klesel
> >
> to_char means you want to do a character ordering not a date ordering. You
> might try
> to_char(first_time,'yyyymmddhh24miss')
> Jim

Or try this:

select

        to_char(first_time),
        count(first_time)
from v$log_history
        group by to_char(first_time)
        order by to_date(to_char(first_time));
Received on Thu Jul 08 2004 - 04:45:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US