3

I have two tables:

table1 - columns: id, name
table2 - columns: id_table2, id, creation_date 

Is it possible to execute mysqldump like this:

mysqldump --single-transaction -u<uname> -p<pass> <databasename> 
<table1> --where="id in (select id from table2 where creation_date>'2016-08-05')" 
<table2> --where="creation_date>'2016-08-18'" > D:\dump.sql

Is there a syntax error because I get the following error:

mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `table1`
WHERE creation_date>'2016-08-18'': Unknown column 'creation_date' in 'where clause' (1054)
laura
  • 2,085
  • 13
  • 36
  • 68
  • Maybe this related post could help you: http://stackoverflow.com/questions/935556/mysql-dump-by-query – FragBis Aug 18 '16 at 13:38
  • @FragBis i want to dump 2 tables in one mysqldump execution and for each table i want only a selection using WHERE clause – laura Aug 18 '16 at 13:44

1 Answers1

0

Can you first create a "temporary table" with for example "SELECT * INTO temp1 FROM table1 WHERE ...etc." and then dump this temp1 table (and temp2 if you want) ?

FragBis
  • 73
  • 6