Re: SQL Question

From: Bill Cotton <cotton_bill_at_hotmail.com>
Date: 1998/06/25
Message-ID: <359275EC.6F09_at_hotmail.com>#1/1


johnnie (isg cooper) wrote:
>
> Is there any solution on OpenIngres, SQLAnywhere, MSAccess?
>
> Thanks!!
>
> > On Sat, 20 Jun 1998, 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
 

> > On Mon, 22 Jun 1998, TC <tc_at_arcom.com.au> wrote:
>
> Johnnie:

I can't see why you want to do this in the first place as you can keep count of returned rows anyway, but most incarnations of SQL allow you to include non-database variables as part of the query.

e.g.

a select loop something like this :-
define int mycount (or whatever language you use)

select my_count, tab_field1, tab_field2 into :my_count2, :myout1, :myout2
from mytable
where ..

begin

    my_count = my_count + 1
    call process_row
end

> >
> >
Received on Thu Jun 25 1998 - 00:00:00 CEST

Original text of this message