Rudy Limeback:
是的,这相当简单。
select 'Customers' as tablename
, count(*) as row_count
from Customers
union all
select 'Orders' as tablename
, count(*) as row_count
from Orders
union all
select 'Products' as tablename
sql语句怎么查询两张表的数据 , count(*) as row_count
from Products
union all
...
如果你需要在你的数据库⾥的所有表上做这个查询,考试#⼤提⽰可以从INFORMATION_SCHEMA.TABLES视图⽣成表清单:
select table_name
from information_schema.tables
where table_schema = 'mydatabase'
然后你可以利⽤这个查询的结果集和⼀个⽂本编辑器⽣成第⼀个查询。
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论