MySQL Math and COUNT (*) in LIMIT

Is it possible to allow MySQL LIMIT to have an offset from the total number of rows divided by 2, so that the query will look something like this:

SELECT * FROM test LIMIT COUNT(*) / 2, 5

Where 5 is just a number.

+4
source share
1 answer

It's impossible.

In the documentation:

Expressions can be used at multiple points in SQL statements, such as the ORDER BY or HAVING clauses of SELECT statements, the WHERE clause of a SELECT, DELETE or UPDATE statement, or the SET statement.

Also from the SELECT documentation :

LIMIT , SELECT. LIMIT , ( , ).

: , .

+6

All Articles