怎样把多个select count(*) 语句执行的结果合成一个sql语句啊?
比如:selectcount(*)fromFlow_CreateProject_GXwherecompanyid=95041selectcount(*)fromFlow_...
比如:select count(*) from Flow_CreateProject_GX where companyid=95041
select count(*) from Flow_ProjectFinish where companyid=95041
select count(*) from Flow_SDSKJFZJH where companyid=95041
select count(*) from Flow_JNSKJFZJH where companyid=95041
把这四个查询结果合成一个sql语句,怎么做??、急用 展开
select count(*) from Flow_ProjectFinish where companyid=95041
select count(*) from Flow_SDSKJFZJH where companyid=95041
select count(*) from Flow_JNSKJFZJH where companyid=95041
把这四个查询结果合成一个sql语句,怎么做??、急用 展开
4个回答
展开全部
select count(a.*) as count1,count(b.*) as count2,count(c.*) as count3,count(d.*) as count4 from Flow_CreateProject_GX as a, Flow_CreateProject_GX as b,Flow_SDSKJFZJH as c,Flow_JNSKJFZJH as d where companyid=95041
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select count(*) from Flow_CreateProject_GX where companyid=95041 union all
select count(*) from Flow_ProjectFinish where companyid=95041 union all
select count(*) from Flow_SDSKJFZJH where companyid=95041 union all
select count(*) from Flow_JNSKJFZJH where companyid=95041;
select sum(*) from (
select count(*) from Flow_CreateProject_GX where companyid=95041 union all
select count(*) from Flow_ProjectFinish where companyid=95041 union all
select count(*) from Flow_SDSKJFZJH where companyid=95041 union all
select count(*) from Flow_JNSKJFZJH where companyid=95041
)
select count(*) from Flow_ProjectFinish where companyid=95041 union all
select count(*) from Flow_SDSKJFZJH where companyid=95041 union all
select count(*) from Flow_JNSKJFZJH where companyid=95041;
select sum(*) from (
select count(*) from Flow_CreateProject_GX where companyid=95041 union all
select count(*) from Flow_ProjectFinish where companyid=95041 union all
select count(*) from Flow_SDSKJFZJH where companyid=95041 union all
select count(*) from Flow_JNSKJFZJH where companyid=95041
)
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2011-09-13
展开全部
union 后再来一个sum
追问
给我个例子吧!我不知道把sum写哪里啊?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询