参会人员统计报表

=====================新表=============================


select
AA.UserID AS UserID ,
AA.UserName AS UserName,
SUM( 1) AS SumNeedJoinMeetingCount ,
SUM( CASE WHEN AA.JoinBeginDate IS NULL THEN 0 ELSE 1 END) AS SumReallyJoinMeetingCount
from
(select
U.UserID AS UserID,
U.UserName AS UserName,
M.BeginDate AS MeetingBeginDate,
J.BeginDate AS JoinBeginDate
from
T_Meeting AS M ,
T_JoinMeetingPerson AS J,
T_UserBaseInfo AS U
WHERE
M.MeetingID = J.MeetingID and
U.UserID = J.UserID and
M.MeetingID =37) as AA
group by
AA.UserID,
AA.UserName

 

 

 

 

 

====================旧表============================

Select
BB.UserID,
BB.UserName,
Sum( NeedJoinMeetingCount ) As SumNeedJoinMeetingCount,
Sum( ReallyJoinMeetingCount ) As SumReallyJoinMeetingCount
From
( Select
BeginDate,
MeetingID,
AA.UserID,
AA.UserName,
1 As NeedJoinMeetingCount,
Case When AA.AttDateTime IS Null Then 0 Else 1 End As
ReallyJoinMeetingCount
From
( Select
A.MeetingID MeetingID,
D.UserName As UserName,
A.MeetingCaption,
A.BeginDate As BeginDate,
C.UserID,
( Select Top 1 AttDateTime From T_AttDataInfo Where CardNo = D.LogonID And AttDateTime >= DateAdd(Minute,-20,A.BeginDate) And AttDateTime <= DateAdd(Minute,20,A.BeginDate) ) As AttDateTime
From T_Meeting A, T_MeetingAddress B, T_JoinMeetingPerson C, T_UserBaseInfo D Where A.MeetingAddressID = B.MeetingAddressID And A.MeetingID = C.MeetingID And C.UserID = D.UserID and A.MeetingID = 37
) As AA
) as BB
Group By BB.UserID,BB.UserName,MeetingID

posted @   每天进步一点点!  阅读(420)  评论(0编辑  收藏  举报
编辑推荐:
· 智能桌面机器人:用.NET IoT库控制舵机并多方法播放表情
· Linux glibc自带哈希表的用例及性能测试
· 深入理解 Mybatis 分库分表执行原理
· 如何打造一个高并发系统?
· .NET Core GC压缩(compact_phase)底层原理浅谈
阅读排行:
· 新年开篇:在本地部署DeepSeek大模型实现联网增强的AI应用
· DeepSeek火爆全网,官网宕机?本地部署一个随便玩「LLM探索」
· Janus Pro:DeepSeek 开源革新,多模态 AI 的未来
· 互联网不景气了那就玩玩嵌入式吧,用纯.NET开发并制作一个智能桌面机器人(三):用.NET IoT库
· 上周热点回顾(1.20-1.26)
点击右上角即可分享
微信分享提示