这不应该在 MySQL 中工作吗?
select * from (show table status like '%fubar%') as t1;
甚至
select name, rows from (show table status like '%fubar%') as t1 where rows>0;
这是我收到的错误:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'show table status like '%fubar%') as t1' at line 1
show table foo like '%something%'
或 show tables like '%something%'
不能以这种方式在子查询中使用吗?您还能如何从所有匹配特定模式的表中进行选择?
最佳答案
SELECT table_name as name, table_rows as rows FROM information_schema.tables as t1
WHERE table_rows > 0
这是检索您要查找的信息的另一种方法。
关于mysql - 在子查询中显示表状态?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6191897/