我有两张桌子:
table1 - columns: id, name
table2 - columns: id_table2, id, creation_date
是否可以像这样执行mysqldump:
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
是否存在语法错误,因为我收到以下错误:
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)
答案 0 :(得分:0)
你能先创建一个“临时表”,例如“SELECT * INTO temp1 FROM table1 WHERE ... etc.”然后转储此temp1表(如果需要,还可以转换为temp2)?