The DB2 equivalent for the MySQL Limit

by

In MySQL, you can use “Limit n,m”, like this:

select *
from sometable
order by name
limit 20,10

And in DB2, use this query:

SELECT * FROM
(SELECT * FROM sometable
ORDER BY name DESC fetch first {start} rows only ) AS mini
ORDER BY mini.name ASC fetch first {total} rows only
SELECT * FROM
(SELECT * FROM sometable
ORDER BY name DESC fetch first 20 rows only ) AS mini
ORDER BY mini.name ASC fetch first 10 rows only

In Oracle: http://www.withdata.com/ad/oracle/how-to-limit-the-number-of-rows-returned-by-an-oracle-query-after-ordering.html .

In SQL Server: http://www.withdata.com/ad/sql-server/the-sql-server-equivalent-for-the-mysql-limit.html .

In Mysql: http://www.withdata.com/ad/mysql/how-to-limit-the-number-of-rows-returned-by-an-mysql-query.html .

In Sqite: http://www.withdata.com/ad/sqlite/how-to-limit-the-number-of-rows-returned-by-an-sqlite-query.html .

In PostgreSQL: http://www.withdata.com/ad/postgresql/how-to-limit-the-number-of-rows-returned-by-an-postgresql-query.html .

You can visit this page for more information: http://stackoverflow.com/questions/3885193/equivalent-of-limit-for-db2 .

Some DB2 tools you can try: https://www.withdata.com/db2/