Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2009
    Posts
    4

    Unhappy Unanswered: fetching the rows from table

    Hi,

    I have a db2 table with 600 rows.

    I need to write 3 sql queries

    the first query should retrieve first 200 rows in that table
    next query should retrive the next 200 rows from that table
    next query should retrive the next 200 rows from that table

    i knw how to write the sql query for this req in oracle db but I dnt have any idea about DB2.. can anyone help me on this?

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    with t1 as (rownum, col1, col2,...) as (
    select row_number() over (order by col1),x.*
    from mytable as x
    ) select * from t1 where rownum between 1 and 200

    Change the between clause for the other 2 queries.

    Andy

Posting Permissions

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