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 , count(*) as row_count from Products union all ... |
如果你需要在你的数据库里的所有表上做这个查询,那你可以从INFORMATION_SCHEMA.TABLES视图生成表清单:
select table_name from information_schema.tables where table_schema = 'mydatabase' |
然后你可以利用这个查询的结果集和一个文本编辑器生成第一个查询。