php - MYSQLdump 不能在 where 子句中使用 SELECT 语句
问题描述
我环顾四周,据我所知这应该可以正常工作我尝试使用我的 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 中提供插入语句
我已经在原始 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
像其他人一样不返回任何记录但创建结构
解决方案
推荐阅读
- c++ - 如何使用 select() 为套接字设置计时器?
- sql - 将一年中的一周与“溢出”进行比较
- javascript - 在 React Uploady 中显示确认屏幕预上传的正确方法?
- javascript - 如何以角度将数据从表单传递到另一个组件
- python-3.x - 在 python 中传递一个列表而不是两个列表
- cmake - 我如何使用 Cmake LibFindMacros
- r - 需要数字/复数矩阵/向量参数
- cypress - 在 Cypress typescript 项目中导入 node js 模块
- async-await - Blazor 如何在打印前正确等待要加载的数据?
- arrays - 为什么函数不返回带有可替换关键字的新行?