I want to use mysqldump to retrieve X first rows from a database (where "first" are ordered by primary key).
I'm trying to use mysqldump the following way:
mysqldump [connection-info] -where"1=1 LIMIT 40" --order-by-primary database table >> file.sql
(this is inside a script who runs different configurations for different tables)
Now, the problem, that command creates the following query:
SELECT /*!40001 SQL_NO_CACHE */ * FROMtableWHERE 1=1 LIMIT 40 ORDER BY primary_key
Is an invalid query, I need the LIMIT 40 to be placed after the ORDER BY statement.
--where "<idcol> <= 40"or similar. – jkavalik May 14 '16 at 10:22