具有多个 LIKE 值的 SHOW TABLES 语句
mysql> SHOW TABLES like 'cms'; +-------------------------+ | Tables_in_tianyan (cms) | +-------------------------+ | cms | +-------------------------+ 1 row in set (0.00 sec)
结果
mysql> SHOW TABLES like 'cms' or like 'role'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual...
如何按多个条件进行过滤?
mysql> SHOW TABLES like 'cms'; +-------------------------+ | Tables_in_tianyan (cms) | +-------------------------+ | cms | +-------------------------+ 1 row in set (0.00 sec)
Result
mysql> SHOW TABLES like 'cms' or like 'role'; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual...
How can I filter by multiple conditions ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
您需要使用
WHERE
子句。如文档所示,您只能有一个如果您使用“SHOW TABLES LIKE ...”
,则为单一模式,但如果您使用“SHOW TABLES WHERE ...”
,则可以在WHERE子句中使用表达式。由于您需要一个表达式,因此需要使用WHERE
子句。You need to use the
WHERE
clause. As shown in the docs, you can only have a single pattern if you use"SHOW TABLES LIKE ..."
, but you can use an expression in the WHERE clause if you use"SHOW TABLES WHERE ..."
. Since you want an expression, you need to use theWHERE
clause.您可以使用普通的 SQL
WHERE
语句来完成此操作。You can just use a normal SQL
WHERE
statement to do it.您可以使用以下代码获取表格列表
You take table list using the below code
这会有所帮助
this will help