Re: SQL Question

From: Ngkc Paul <paulkcng_at_netvigator.com>
Date: 1998/06/22
Message-ID: <Pine.SOL.3.96.980622180910.15599A-100000_at_imsnispc01.netvigator.com>#1/1


Some problems for your SQL. First, it cannot run on oracle, Seconds, if the sort key is not unique, the result may be wrong. Third, it may cause performance isuue if the table is large.

On Mon, 22 Jun 1998, Volker B wrote:

> js wrote:
>
> > I am trying to figure out how to get a result set in which the row
> > number is a column in the result set. For example, if I select n rows
> >
> > from a table, I need a column to contain 1 thru n. Optimally, the
> > syntax needs to be ANSI standard SQL, but nearly any solution will do.
> >
> > Anyone have ideas?
> >
> > TIA
> > JS
>
> Hi,if the selected rows are sorted (for example by field 'sort field')
> the following will work:
> 'select (select count (sort field) +1 from table t1 where
> t1.sort field<t2.sort field), .... from table t2 order by t2.sort field'
>
> Volker Boess
>
>
>
Received on Mon Jun 22 1998 - 00:00:00 CEST

Original text of this message