求助如何将两个Sql语句合并生成一个语句输出
selecta.ygxm,count(*)ascfromb_bbsInfoa,b_bbsInfobwherea.pTxtId=b.txtIdgroupbya.ygxmha...
select a.ygxm,count(*) as c from b_bbsInfo a,b_bbsInfo b where a.pTxtId=b.txtId group by a.ygxm
having count(*) > 0
生成数据如下:
ygxm c
A 2
B 1
select a.ygxm,count(*) as b from b_bbsInfo a where a.typecode='1' and a.pTxtid='0' group by a.ygxm
having count(*) > 0
ygxm b
A 3
C 1
如何将上述的两个语句综合生成
ygxm c b
A 2 3
B 1 0
C 0 1 展开
having count(*) > 0
生成数据如下:
ygxm c
A 2
B 1
select a.ygxm,count(*) as b from b_bbsInfo a where a.typecode='1' and a.pTxtid='0' group by a.ygxm
having count(*) > 0
ygxm b
A 3
C 1
如何将上述的两个语句综合生成
ygxm c b
A 2 3
B 1 0
C 0 1 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询