专业编程基础技术教程

网站首页 > 基础教程 正文

sql 多表取 count 再 sum

ccvgpt 2024-08-07 18:37:18 基础教程 14 ℃



sql 多表取 count 再 sum

要统计所有的用户量,从多个表里查询数量,然后进行取和,sql 如下:


select sum(tmpcount) from (

select count(*) as tmpcount from tab1

union all

select count(*) as tmpcount from tab2

) a

Tags:

最近发表
标签列表