1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
0
【以下的回答经过翻译处理】 您可以将此视为两个步骤的过程。
- 动态生成用于获取计数的SQL查询。
- 运行SQL查询的输出以生成计数结果。
with tname_vw(i) as (
SELECT concat(
'select ''',
table_name,
''' as table_name, count(*) from ',
table_name
)
FROM information_schema.tables
WHERE table_schema = 'schema_name'
)
select array_join(array_agg(i), ' union ') as result
from tname_vw