Subject | Re: [firebird-support] How To Generate Auto Increment Number in SQL Itself ? |
---|---|
Author | Vishal Tiwari |
Post date | 2015-03-13T12:43:33Z |
Hi Louis,
One little bit advance question with respect to my previous question.
Say for example, my sql returns total 100 records in that it returns 10 records for every employee. Here I would I display Row_Number as 1 for first 10 records i.e. for first employee, then for next 10 records i.e. for second employee Row_Number as 2, and so on. So finally Row_Number value should endup with 10.
Any idea how would it possible?
Thanks In Advance.
With Best Regards.
Vishal
On Friday, 13 March 2015 6:07 PM, Vishal Tiwari <vishualsoft@...> wrote:
Thank You So Much !!!! Louis van Alphen....
You saved me....
Thanks A Ton Again !!!!!!
On Friday, 13 March 2015 5:50 PM, "'Louis van Alphen' louis@... [firebird-support]" <firebird-support@yahoogroups.com> wrote:
select
cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer) as row_number,
rdb$set_context('USER_TRANSACTION', 'row#',
coalesce(cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer), 0) + 1),
< other columns>
from MY_TABLE
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: 13 March 2015 01:58 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] How To Generate Auto Increment Number in SQL Itself ?
Hi All,
I have one question, any SQL I write, I would like to get auto-increment number (separate column obviously) to every row starting with 1. It is just to numbering every record I get as an output of my sql. I do not want to use Generate which we do on table. This is just for SQL output I need.
Thanks In Advance.
With Best Regards.
Vishal
[Non-text portions of this message have been removed]
cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer) as row_number,
rdb$set_context('USER_TRANSACTION', 'row#',
coalesce(cast(rdb$get_context('USER_TRANSACTION', 'row#') as integer), 0) + 1),
< other columns>
from MY_TABLE
From: firebird-support@yahoogroups.com [mailto:firebird-support@yahoogroups.com]
Sent: 13 March 2015 01:58 PM
To: firebird-support@yahoogroups.com
Subject: [firebird-support] How To Generate Auto Increment Number in SQL Itself ?
Hi All,
I have one question, any SQL I write, I would like to get auto-increment number (separate column obviously) to every row starting with 1. It is just to numbering every record I get as an output of my sql. I do not want to use Generate which we do on table. This is just for SQL output I need.
Thanks In Advance.
With Best Regards.
Vishal
[Non-text portions of this message have been removed]