mys*_*_go 31 mysql sql mysql-error-1064
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...
如何根据多个条件进行过滤?
Ric*_*ams 61
您需要使用该WHERE子句.如文档中所示,如果使用"SHOW TABLES LIKE ...",则只能使用单个模式,但如果使用,则可以在WHERE子句中使用表达式"SHOW TABLES WHERE ...".由于您需要表达式,因此需要使用该WHERE子句.
SHOW TABLES
FROM `<yourdbname>`
WHERE
`Tables_in_<yourdbname>` LIKE '%cms%'
OR `Tables_in_<yourdbname>` LIKE '%role%';
Run Code Online (Sandbox Code Playgroud)
mik*_*kel 16
您可以使用普通的SQL WHERE语句来执行此操作.
SHOW TABLES WHERE Tables_in_tianyan LIKE '%cms%'
Run Code Online (Sandbox Code Playgroud)
show tables from mydb
where
Tables_in_mydb like '%statistics%'
or Tables_in_mydb like '%device%';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
69502 次 |
| 最近记录: |