MYSQLdump无法使用where子句

时间:2018-05-30 16:25:24

标签: php mysql

我环顾四周,尽管可以说这应该可以正常工作 我试图使用我的sql转储获取一堆注释评论,我已经使用了语句,如--no-data和WHERE的其他变体,但没有这个 我一直用PHP做这件事

mysqldump --user=root --host=localhost DB notes_comments --where="notes_comments.note_id IN (SELECT notes.note_id FROM notes WHERE notes_category_id=1 OR notes.datetime_created > '2018-04-30 18:16:15')" > db.sql

上面的语句是我想要使用的语句,但结果中没有记录,db.sql文件如果存在则删除表,然后创建它但没有记录

但是,如果我使用: mysqldump --user=root --host=localhost DB notes_comments --where="notes_comments.note_id IN (1,2,3,4,5)" > db.sql 它工作并在db.sql中提供一个insert语句

我已经测试了原始WHERE中的SELECT并在WHERE中测试了它以获取我想要的记录并且工作正常。

我不确定问题是什么

使用额外的身份进行修改:

mysqldump --user=root --host=localhost DB notes_comments --where="notes_comments.note_id IN (SELECT notes.note_id FROM notes)" > db.sql

不会再次返回记录,但会创建结构

mysqldump --user=root --host=localhost DB notes_comments --where="notes_comments.note_id IN (SELECT notes.note_id FROM notes WHERE notes_category_id=1 )" > db.sql

也不返回任何记录,但会创建结构

mysqldump --user=root --host=localhost DB notes_comments --where="notes_comments.note_id IN (SELECT notes.note_id FROM notes WHERE notes.datetime_created > '2018-05-01 10:20:29')" > db.sql

与其他人一样,不会返回任何记录,但会创建结构

0 个答案:

没有答案