Re: SQL Question

From: (wrong string) öß <boess_at_mail.ifw.uni-hannover.de>
Date: 1998/06/22
Message-ID: <358E101C.5909CF3D_at_mail.ifw.uni-hannover.de>#1/1


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