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: Sort a group of records

Re: Sort a group of records

From: Daniel Morgan <damorgan_at_x.washington.edu>
Date: Wed, 04 Aug 2004 21:46:36 -0700
Message-ID: <1091681232.867237@yasure>


Jochen wrote:

> Hallo,
>
> i want to sort a group of data with. The group of data shows in column
> 'Field3'. The sort order shows in column 'Field4'.
>
> This is the select statement for the rusult.
>
>
> select l.Field1, l.Field2, l.Field3, l.Field4
> from table1 l, table2 ma, table3 c, teable4 ls
> where ma.id = l.archive_id
> and c.id = l.Field2
> and ls.id = l.Field3
> and l.Field2 = 1
> order by l.Field2, l.field3, l.field4, ma.s_description
>
>
>
> Field1 Field2 Field3 Field4
> 1 1 4 10
> 1 1 4
> 1 1 5 20
> 1 1 11 30
> 1 1 11
> 1 1 12 50
> 1 1 12
> 1 1 16 40
> 1 1 16
> 1 1 66 10
> 0 1 66
> 1 1 137 20
> 1 1 138 30
> 1 1 142 40
> 1 1 326 10
> 1 1 327 20
> 1 1 328 30
> 1 1 445 20
> 0 1 445
> 0 1 445
> 0 1 445
> 1 1 456 10
> 0 1 456
> 0 1 456
> 1 1 635 10
> 0 1 635
> 0 1 635
> 1 1 636 20
> 0 1 636
> 0 1 636
> 1 1 637 30
> 0 1 637
> 0 1 637
> 1 1 642 80
> 0 1 642
> 0 1 642
> 0 1 642
> 1 1 644 120
> 0 1 644
> 0 1 644
> 1 1 649 290
>
>
> Now i want a sql statement that sort the group data of field3 and sort
> it with field4. Looks like
>
> Field1 Field2 Field3 Field4
> 1 1 4 10
> 1 1 4
> 1 1 66 10
> 0 1 66
> 1 1 326 10
> 1 1 456 10
> 0 1 456
> 0 1 456
> 1 1 635 10
> 0 1 635
> 0 1 635
> 1 1 5 20
> 1 1 137 20
> 1 1 327 20
> 1 1 445 20
> 0 1 445
> 0 1 445
> 0 1 445
> 1 1 636 20
> 0 1 636
> 0 1 636
> 1 1 11 30
> 1 1 11
> 1 1 138 30
> 1 1 328 30
> 1 1 637 30
> 1 1 16 40
> 1 1 16
> 1 1 142 40
> 0 1 637
> 0 1 637
> 1 1 12 50
> 1 1 12
> 1 1 642 80
> 0 1 642
> 0 1 642
> 0 1 642
> 1 1 644 120
> 0 1 644
> 0 1 644
> 1 1 649 290
>
>
> Please help.
>
> Thank you,
> Jochen

RTFM! ... and while you are at it ... look up "NULLS FIRST".

-- 
Daniel A. Morgan
University of Washington
damorgan_at_x.washington.edu
(replace 'x' with 'u' to respond)
Received on Wed Aug 04 2004 - 23:46:36 CDT

Original text of this message

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