Subject | Re: [firebird-support] How To Generate Auto Increment Number in SQL Itself ? |
---|---|
Author | Ann Harrison |
Post date | 2015-03-13T16:44:26Z |
On Mar 13, 2015, at 8:45 AM, Vishal Tiwari vishualsoft@... [firebird-support] <firebird-support@yahoogroups.com> wrote:
How about a second context variable for the EmpCode and reset the row_number iff the EmpCode changes? Or, if you'd rather number each row for an employee differently and start again at 1 for the next employee, increment the row_number unless EmpCode changes then reset to 1.I have EmpCode column in my SQLSay 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.
Sigh. SQL used to be such a simple ugly stupid language.... Am I the only one who finds this sort of magic unreadable?
Cheers,
Ann