牛骨文教育服务平台(让学习变的简单)
博文笔记

如何用一个SQL语句查询多个表的记录数

创建时间:2010-09-19 投稿人: 浏览次数:8252

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

声明:该文观点仅代表作者本人,牛骨文系教育信息发布平台,牛骨文仅提供信息存储空间服务。