我有一个名为Test的模式,它有表A, B, C
。
我想在一个命令中获取每个表的count(row)
。
答案 0 :(得分:1)
select count(*) as a_count, null as b_count, null as c_count from A
union
select null, count(*), null from B
union
select null, null, count(*) from C
答案 1 :(得分:0)
这也有效:
SELECT (SELECT COUNT(*)
FROM A ) AS A_count,
(SELECT COUNT(*)
FROM B ) AS B_count,
(SELECT COUNT(*)
FROM C ) AS C_count;
UNION
)NULL
列