如何用一个SQL语句查询多个表的记录数
转自:http://blog.csdn.net/keketrtr/article/details/5894067
sql语句如下:
select t1.num1,t2.num2 from
(select count(*) num1 from table1) t1,
(select count(*) num2 from table2) t2
如果要显示这两张表中记录数的总和就是
select t1.num1+t2.num2 from
(select count(*) num1 from table1) t1,
(select count(*) num2 from table2) t2
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇: mysql查询重复记录的方法
- 下一篇: linux shell 判断 文件整数 存在、大小、空、等