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

posted on 2017-09-06 12:03  长风剑客  阅读(2640)  评论(0编辑  收藏  举报

导航