MYSQL如何把两个结构相同的表组成一个表查询select * from (select uid,count(*) as sc from `bbs_topics` group by uid) as a,(select uid,count(*) as sc from `bbs_reply` group by uid) as b where a.uid=b.uid我向要取得两个表的数量
来源:学生作业帮助网 编辑:六六作业网 时间:2025/01/12 03:10:38
MYSQL如何把两个结构相同的表组成一个表查询select * from (select uid,count(*) as sc from `bbs_topics` group by uid) as a,(select uid,count(*) as sc from `bbs_reply` group by uid) as b where a.uid=b.uid我向要取得两个表的数量
MYSQL如何把两个结构相同的表组成一个表查询
select * from
(select uid,count(*) as sc from `bbs_topics` group by uid) as a,
(select uid,count(*) as sc from `bbs_reply` group by uid) as b
where a.uid=b.uid
我向要取得两个表的数量总和并且group by uid
MYSQL如何把两个结构相同的表组成一个表查询select * from (select uid,count(*) as sc from `bbs_topics` group by uid) as a,(select uid,count(*) as sc from `bbs_reply` group by uid) as b where a.uid=b.uid我向要取得两个表的数量
select uid,sum(sc) sl from
(select uid,count(*) as sc from `bbs_topics` group by uid
union
select uid,count(*) as sc from `bbs_reply` group by uid)
group by uid