Usar subconsultas (subqueries) con mysqldump

Para estudiar una porción de los datos de Bisicalc, necesitaba poner en un fichero .sql el resultado de una consulta:

SELECT * 
FROM `statuses` 
WHERE update_id in (
   select id 
   from updates 
   where timestamp >='2011-12-01' and timestamp < '2012-01-01'
)

El problema es que al usar mysqldump me daba un error: Table ‘updates’ was not locked with LOCK TABLES (1100)

La solución: llamar a mysqldump con el parámetro “–lock-all-tables”

mysqldump -t -u root --lock-all-tables -p bisicalcdb_prod statuses --where="update_id in (select id from updates where timestamp >='2011-12-01' and timestamp < '2012-01-01')" > 201112_december_statuses.sql