Results 1 to 4 of 4

Thread: db2 row_number

  1. #1
    Join Date
    Sep 2013
    Location
    India
    Posts
    246

    Unanswered: db2 row_number

    Hello all,

    I am using db2 v 10.5 on AIX, I want to know the working behind

    select row_number() over(), some_column from my_table

    How row number is retrieved and assigned ?

    thanks in advance.

    sumit
    ssumit

  2. #2
    Join Date
    Apr 2008
    Location
    Iasi, Romania
    Posts
    561
    Provided Answers: 2
    Did you try reading docs?
    Florin Aparaschivei
    DB2 9.7, 10.5 on Windows
    Iasi, Romania

  3. #3
    Join Date
    Sep 2013
    Location
    India
    Posts
    246
    yes i have read the docs and i understand the use of over() when used with row_number() but what when over() is left without any parameter (empty) ?

    thanks.
    ssumit

  4. #4
    Join Date
    Feb 2008
    Location
    Japan
    Posts
    3,483
    It was documented in InfoCenter.

    Database fundamentals > SQL > Language elements > Expressions >
    OLAP specification
    ...
    ...

    The ROW_NUMBER (or ROWNUMBER) function computes the sequential row number of the row within the window defined by the ordering, starting with 1 for the first row.
    If the ORDER BY clause is not specified in the window, the row numbers are assigned to the rows in arbitrary order,
    as returned by the subselect (not according to any ORDER BY clause in the select-statement)
    .

    ...
    ...
    Note: Bold/Italic was by me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •