Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Date ordering problem
M2 wrote:
> In article <9315k3$ki3$1_at_nnrp1.deja.com>,
> M2 <mmortonallen_at_csu.edu.au> wrote:
> > Hi All,
> > I have what appears to be a simple problem but I just can't get my
head
> > around it. I have the following query in a report how many actions
were
> > performed on a given day:
> >
> > select
> > to_char(date_logged, 'DD-MON-YYYY'), count(*)
> > from
> > log
> > group by
> > to_char(date_logged, 'DD-MON-YYYY')
> > order by
> > to_char(date_logged, 'DD-MON-YYYY)
> >
> > My problem is that I need this to be in chronological order and it's
in
> > asciibetical order. I have tried lots of combinations of things but I
> > always run into a problem. If anyone could shed some light on this for
> > me I would really appreciate it.
>
> umm I neglected to mention that I need the report to supply to DD-MON-
> YYYY format even though I need it sorted by something like YYYYMMDD.
>
> Matt.
>
Hi Matt,
I hope it helps
SELECT COUNT(*), TO_CHAR(last_ddl_time, 'DD-MON-YYYY')
FROM user_objects
GROUP BY TO_CHAR(last_ddl_time, 'YYYYMMDD'), TO_CHAR(last_ddl_time,
'DD-MON-YYYY')
ORDER BY TO_CHAR(last_ddl_time, 'YYYYMMDD')
;
Valery Yourinsky
-- Oracle8 Certified DBAReceived on Thu Jan 04 2001 - 04:35:07 CST
![]() |
![]() |