sql 一个结果集 如何跟另一个集 join 15

select*from(selectattdaydata.EmpNo,EmpName,dtname,EmpTypeName,PartName,sum(OverTime)a... select * from (
select attdaydata.EmpNo,EmpName,dtname,EmpTypeName,PartName,
sum(OverTime) as skjb,sum(OverTime1+OverTime2+OverTime3) as zsjb,sum(ReqOverTime)as webflow
from attdaydata
join perEmployee on attdaydata.EmpID=perEmployee.EmpID where CONVERT(varchar(12) ,YYMMDD, 112 )
between 20140223 and 20140301 and EmpTypeName='不限36小时'
GROUP BY attdaydata.EmpNo,EmpName,dtname,EmpTypeName,PartName
) as a
--
select * from
(
select workno,sum(sqzss) as sqzss from view_Overtime3 where wovtdte between 20140223 and 20140301 group by workno
)
as b

如何把这两个结果集 连在一起

select * from
(
select * from (
select attdaydata.EmpNo,EmpName,dtname,EmpTypeName,PartName,
sum(OverTime) as skjb,sum(OverTime1+OverTime2+OverTime3) as zsjb,sum(ReqOverTime)as webflow
from attdaydata
join perEmployee on attdaydata.EmpID=perEmployee.EmpID where CONVERT(varchar(12) ,YYMMDD, 112 )
between 20140223 and 20140301 and EmpTypeName='不限36小时'
GROUP BY attdaydata.EmpNo,EmpName,dtname,EmpTypeName,PartName
) as a
join
select * from
(
select workno,sum(sqzss) as sqzss from view_Overtime3 where wovtdte between 20140223 and 20140301
group by workno
)
as b
on a.empno=b.workno
) as c
展开
 我来答
那时花开应自在
2014-03-05 · 超过40用户采纳过TA的回答
知道小有建树答主
回答量:94
采纳率:0%
帮助的人:72.2万
展开全部
select * from
(
select * from
(
select * from (
select attdaydata.EmpNo,EmpName,dtname,EmpTypeName,PartName,
sum(OverTime) as skjb,sum(OverTime1+OverTime2+OverTime3) as zsjb,sum(ReqOverTime)as webflow
from attdaydata
join perEmployee on attdaydata.EmpID=perEmployee.EmpID where CONVERT(varchar(12) ,YYMMDD, 112 )
between 20140223 and 20140301 and EmpTypeName='不限36小时'
GROUP BY attdaydata.EmpNo,EmpName,dtname,EmpTypeName,PartName
)
) a,
(select * from
(
select workno,sum(sqzss) as sqzss from view_Overtime3 where wovtdte between 20140223 and 20140301
group by workno
)
) b
where a.empno=b.workno
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
匿名用户
2014-03-05
展开全部
结果集可以用别名的
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
来自慕田峪长城好心的冬青
2014-03-11 · 超过32用户采纳过TA的回答
知道答主
回答量:118
采纳率:0%
帮助的人:90.7万
展开全部
使用union
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式