Subject Re: [firebird-support] How To Generate Auto Increment Number in SQL Itself ?
Author Mark Rotteveel
On 13-3-2015 17:44, Ann Harrison aharrison@...
[firebird-support] 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.
> Sigh. SQL used to be such a simple ugly stupid language.... Am I the
> only one who finds this sort of magic unreadable?

Probably because it isn't SQL at all, it is an ugly hack that happens to
work with Firebird. With the SQL standard ROW_NUMBER window function in
Firebird 3 it works well and intelligible.

Mark Rotteveel