永发信息网

SQL count 多表总数求和问题

答案:3  悬赏:80  手机版
解决时间 2021-03-29 22:50
  • 提问者网友:
  • 2021-03-29 01:52
SQL count 多表总数求和问题
最佳答案
  • 五星知识达人网友:独钓一江月
  • 2021-03-29 03:26
可以这样写:
select
(select count(*) from bumen)+(select count(*) from mrs) as sum_count

如果两个表结果相同的话,也可以用
select count(*) as sum_count
from
(
select * from A
union all
select * from B
) as tmp
全部回答
  • 1楼网友:酒者煙囻
  • 2021-03-29 05:00
select
(select count(*) from bumen)+(select count(*) from mrs) as sum_count
  • 2楼网友:十年萤火照君眠
  • 2021-03-29 04:31
select sum(b.rowcnt)
from sysobjects a join sysindexes b on a.id=b.id and a.xtype='u' and b.indid<2
where a.name in('A','B')
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯