Stella inattivaStella inattivaStella inattivaStella inattivaStella inattiva
 

MySQL has the keyword LIMIT x,y that allow you to make an easy and flexible pagination.

LIMIT x,y :

x means start from row

y means return only some rows

 

In DB2/400, starting from Version 5 Release 4, is available the ROW_NUMBER() function.

Here an example :

WITH MYRECSET  (MYRRN, MYROW, MYFIELD1, MYFIELD2, MYFIELD3) as   (

SELECT  RRN(MYLIB.MYTABLE) as MYRRN,
             ROW_NUMBER() OVER (ORDER BY MYFIELD1, MYFIELD2) AS MYROW,
            MYFIELD1, MYFIELD2, MYFIELD3
            FROM MYLIB.MYTABLE )

SELECT * FROM MYRECSET
            WHERE MYROW > 20
            FETCH FIRST 10 ROWS ONLY

 

As you can see
MySQL "LIMIT x,y"  where "x" is  MYROW  ( ROW_NUMBER() OVER (ORDER BY MyField01) AS MYROW )
and
MySQL "LIMIT x,y" where "y" is  "FETCH FIRST 10 ROWS ONLY"

 

REFERENCES



- have fun -

DISQUS - Leave your comments here