问题描述
我选择查询
选择SUM(GenderId)作为总计,GenderMaster.Gender,来自StudEnroll的atte来自终止会员。
内部联接StudEn上的StudMaster.StudId = StudMaster.StudId左
加入
(选择∑ GenderId)作为totalAttendance,GenderMaster.Gender,StudEnId来自StudEnroll
内部联接StudMaster on StudMaster.StudId = StudEnroll.StudId
内部联接StudAttendance on StudEnroll.CardId = StudAttendance.CardId
内部联接GenderMaster在GenderMaster.GenderId = StudMaster.Gender
,其中YEAR = 1和StudAttendance。 nowday ='2014-10-10'
group by GenderMaster.Gender,StudEnId
)
as atte atte .StudEnId = StudEnroll.StudEnId
内连接GenderMaster上的GenderMaster.GenderId = StudMaster.Gender
- 在StudAttendance.CardId = StudEnroll.CardId上加入StudAttendance b其中Year = 1
- 和tot alAtndance不为空白
group by GenderMaster.Gender,totalAttendance
此查询结果存储到不存在的表中
I have select query
below
select SUM( GenderId) as total ,GenderMaster.Gender,atte.totalAttendance from StudEnroll
inner join StudMaster on StudEnroll.StudId=StudMaster.StudId
left join
(select SUM(GenderId)as totalAttendance,GenderMaster.Gender,StudEnId from StudEnroll
inner join StudMaster on StudMaster.StudId=StudEnroll.StudId
inner join StudAttendance on StudEnroll.CardId=StudAttendance.CardId
inner join GenderMaster on GenderMaster.GenderId=StudMaster.Gender
where YEAR=1 and StudAttendance.nowday='2014-10-10'
group by GenderMaster.Gender,StudEnId
)
as atte on atte.StudEnId=StudEnroll.StudEnId
inner join GenderMaster on GenderMaster.GenderId=StudMaster.Gender
--left join StudAttendance on StudAttendance.CardId=StudEnroll.CardId
where Year =1
-- and totalAttendance is not null
group by GenderMaster.Gender ,totalAttendance
This query result store into without existing table
这篇关于在没有现有表的情况下插入一个表数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!