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

Home -> Community -> Usenet -> c.d.o.tools -> Re: About ordering in SQL

Re: About ordering in SQL

From: <ken_hansen_at_my-deja.com>
Date: Thu, 07 Sep 2000 08:46:02 GMT
Message-ID: <8p7kk5$v2c$1@nnrp1.deja.com>

In article <PyGt5.10147$oL4.210919_at_news2.nokia.com>,   "Artti Jaakkola" <artti.jaakkola_at_novostore.com> wrote:
> If I make following query:
>
> SELECT
> ID
> FROM
> SOMETABLE
> WHERE
> ID IN (1, 4, 6, 2)
>
> ID
> --
> 2
> 6
> 4
> 1
>
> Is the result always ordered like this or is there some better way to
 do it?
>
> --
> - Artti -

After the "where" statement add:
Order by ID
or
Order by 1

Ascending is the default but you could say "Order by 1 DESC" for descending.

When selecting multiple attributes, ordering by Number is much easier than typing in all the names and it avoids another potential source of errors.

Ken_hansen>
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Sep 07 2000 - 03:46:02 CDT

Original text of this message

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