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: SQL query

Re: SQL query

From: <steveee_ca_at_my-deja.com>
Date: Fri, 19 Jan 2001 14:01:51 GMT
Message-ID: <949hca$ceb$1@nnrp1.deja.com>

Hi,

Depending on your oracle version, you can:

1 select rownum,color from
2 (select color from your_table
3* order by color)

Regards,

Steve

In article <3a67446d.784475735_at_news.alt.net>,   SPAMBLOCK.Maxwell_Smart_at_ThePentagon.com.SPAMBLOCK (Brian Tkatch) wrote:
> On Thu, 18 Jan 2001 18:44:32 -0000, "Happy"
> <allan_at_livvy80.freeserve.co.uk> wrote:
>
> >Is it possible in SQL to display the contents of a table in a
 particular
> >order, along with
> >a numeric column that shows the sequence of each row?
> >
> >For example, a table with one column, color, has the following 3
 values:
> >
> >Green
> >Blue
> >Red
> >
> >Say I wanted the alphabetic listing along with the numeric sequence,
> >
> >1 Blue
> >2 Green
> >3 Red
> >
> >Can it be done?
> >
> >Cheers
> >Allan
> >
> >
> You can use RowNum
>
> SELECT RowNum, Name FROM Color;
>
> If you need an ORDER BY:
>
> SELECT RowNum, Name FROM (SELECT Name FROM Color ORDER BY Name);
>
> Brian
>

Sent via Deja.com
http://www.deja.com/ Received on Fri Jan 19 2001 - 08:01:51 CST

Original text of this message

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