码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2017-09-06 14:26:59      阅读:433      评论:0      收藏:0      [点我收藏+]

标签:dev   sql   rom   表数据   查询   数据   from   where   device   

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查询多个表数据量

标签:dev   sql   rom   表数据   查询   数据   from   where   device   

原文地址:http://www.cnblogs.com/changfengSven/p/7484024.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!