Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Offset MySQL Without Limit [duplicate]

Tags:

mysql

Possible Duplicate:
Mysql Offset Infinite rows

Is it possible to specify a query in MySQL with a 'offset' but without a 'limit'. For example:

SELECT * FROM countries OFFSET 2 

Fails, but:

SELECT * FROM COUNTRIES LIMIT 8 OFFSET 2 

Works fine. I'd like to just specify the offset. Thanks!

like image 753
Kevin Sylvestre Avatar asked Jul 04 '10 03:07

Kevin Sylvestre


People also ask

Can I use offset without limit in MySQL?

Basically, no. Limit must be supplied.

What is difference between limit and offset?

The limit option allows you to limit the number of rows returned from a query, while offset allows you to omit a specified number of rows before the beginning of the result set. Using both limit and offset skips both rows as well as limit the rows returned.

What is the difference between limit and offset in MySQL?

MySQL Offset is used to specify from which row we want the data to retrieve. To be precise, specify which row to start retrieving from. Offset is used along with the LIMIT. Here, LIMIT is nothing but to restrict the number of rows from the output.

What can I use instead of limit in MySQL?

To get only the specified rows from the table, MySQL uses the LIMIT clause, whereas SQL uses the TOP clause, and Oracle uses the ROWNUM clause with the SELECT statement.


1 Answers

Basically, no. Limit must be supplied. See this SO question for a solution.

like image 83
George Marian Avatar answered Oct 12 '22 09:10

George Marian