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 in Oracle7.3

Re: Sorting in Oracle7.3

From: Stephan Schaefer <stephan.schaefer_at_camline.com>
Date: Mon, 15 Jun 1998 11:14:00 +0200
Message-ID: <3584E5D8.280F872D@camline.com>


Sjefke wrote:

> Hi Gregory,
>
> Try something like:
>
> CREATE TABLE not_sorted (FIELD1, FIELD2)
> AS
> SELECT FIELD1, FIELD2
> FROM sorted
> GROUP BY FIELD1, FIELD2;
>
> Group by can be 'mis-used'as a order by because it implicitly orders
> the data. Note that even if you want to sort only on FIELD1 you still
> have to include all other fields you select in the group by clause.
>

Hi Gregory, Sjefke.

this version drops doubled entries. To be sure to get all rows you can do:

CREATE TABLE
  sorted
AS SELECT
  FIELD1, FIELD2
FROM
  non_sorted
GROUP BY
  FIELD1,
  FIELD2,
  ROWNUM <===
;
Stephan Schaefer
camLine Datensysteme
mailto:stesch_at_camline.com Received on Mon Jun 15 1998 - 04:14:00 CDT

Original text of this message

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