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

Home -> Community -> Usenet -> c.d.o.misc -> Re: sorting multiple columns

Re: sorting multiple columns

From: Christopher Beck <clbeck_at_us.oracle.com>
Date: Thu, 29 Jul 1999 15:54:25 GMT
Message-ID: <37a378be.98074233@inet16.us.oracle.com>


On Thu, 29 Jul 1999 15:08:45 GMT, h0444vcs_at_rz.hu-berlin.de wrote:

>Dear Participants,
>
>I have the following table :
>
>NAME TIMESTAMP
>----- --------------------
>bernd 22-MAY-1999 13:25:25
>myra 22-MAY-1999 13:25:57
>bernd 22-MAY-1999 13:33:21
>myra 22-MAY-1999 15:20:55
>bernd 22-MAY-1999 17:36:03
>bernd 23-MAY-1999 00:04:17
>myra 23-MAY-1999 06:54:57
>
>The table should be sorted by name and day. The desired output appears
>like :
>
>NAME TIMESTAMP
>----- --------------------
>bernd 22-MAY-1999 13:25:25
>bernd 22-MAY-1999 13:33:21
>bernd 22-MAY-1999 17:36:03
>myra 22-MAY-1999 13:25:57
>myra 22-MAY-1999 15:20:55
>bernd 23-MAY-1999 00:04:17
>myra 23-MAY-1999 06:54:57

Well that looks like you want to sort on date then name so...

select *
  from sort
 order by timestamp, name
/

hope this helps.

chris.

>
>ORDER BY didn't help me on. I tried the following :
>
>SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'DD' ;
>
>Session altered.
>
>SQL> select *
> 2 from sort
> 3 order by name, timestamp
> 4 /
>
>NAME TI
>----- --
>bernd 22
>bernd 22
>bernd 22
>bernd 23
>myra 22
>myra 22
>myra 23
>
>7 rows selected.
>
>Does someone of you know, how I can get to the desired output ?
>Your help will be greatly appreciated !
>
>Markus
>
>
>Sent via Deja.com http://www.deja.com/
>Share what you know. Learn what you don't.

--
Christopher Beck
Oracle Corporation
clbeck_at_us.oracle.com
Reston, VA.



Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Thu Jul 29 1999 - 10:54:25 CDT

Original text of this message

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