mysql一条sql查询多个表数据量

Posted 长风

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql一条sql查询多个表数据量相关的知识,希望对你有一定的参考价值。

select
(select count(*) from device0 where status != 0),
(select count(*) from device1 where status != 0),
(select count(*) from device2 where status != 0),
(select count(*) from device3 where status != 0),
(select count(*) from device4 where status != 0),
(select count(*) from device5 where status != 0),
(select count(*) from device6 where status != 0),
(select count(*) from device7 where status != 0),
(select count(*) from device8 where status != 0),
(select count(*) from device9 where status != 0)
as count

 

 

select
(select count(*) from device0 where status != 0)+
(select count(*) from device1 where status != 0)+
(select count(*) from device2 where status != 0)+
(select count(*) from device3 where status != 0)+
(select count(*) from device4 where status != 0)+
(select count(*) from device5 where status != 0)+
(select count(*) from device6 where status != 0)+
(select count(*) from device7 where status != 0)+
(select count(*) from device8 where status != 0)+
(select count(*) from device9 where status != 0)
as count

以上是关于mysql一条sql查询多个表数据量的主要内容,如果未能解决你的问题,请参考以下文章

Oracle数据库大数据量表如何优化?

sql中如何使一列中的多个重复数据只显示第一条

mysql 多个条件的删除一条记录的语句

mysql查看一条sql更新了多少数据

《数据库优化》- MySQL视图

求助一条mysql 更新 语句 where 后面为查询的结果