GCP SPANNER:如何使用单个 select 语句从多个表中获取记录计数

GCP SPANNER: How to take count of records from multiple tables with single select statement

我需要使用单个 select 语句从 SPANNER 中的多个表中获取计数。在传统的Oracle DB中,我习惯了以下查询方式。

有人可以建议我如何在 SPANNER 中执行此操作。

select (SELECT count(1) FROM Table1 where Column1='ABC') as Count1, (SELECT count(1) FROM Table2 where Column2='ABC') as Count2, (SELECT count(1) FROM Table3 where Column3='ABC') as Count3, from dual;

我认为我们不能 运行 在 SPANNER 中使用存储过程。如有错误请指正

from dual 部分是 Oracle 特有的。您可以在 Spanner 中使用以下查询:

select (select count(*) from foo) as c1, (select count(*) from bar) as c2