对符合条件的 数据统计个数「终于解决」

对符合条件的 数据统计个数「终于解决」select max(m.check_score) as jcmax , min(m.check_score) as jcmin ,avg(m.check_score) as jcavg ,coun…

对符合条件的 数据统计个数

select   max(m.check_score) as jcmax , min(m.check_score)  as jcmin ,avg(m.check_score) as jcavg ,count(*) as jccount ,sum( case  when m.check_score >=80 then 1 else 0 end) as jcdbs
		, max(m.self_score) as zcmax , min(m.self_score)  as zcmin ,avg(m.self_score) as zcavg ,count(*) as zccount ,sum( case  when m.self_score >=80 then 1 else 0 end) as zcdbs
		from tb_report_anfang_result m,
		(select max(create_time) as create_time , dept_id from tb_report_anfang_result r where r.dept_id in
		<foreach collection="depts" item="item" index="index"
				 separator="," open="(" close=")">
			#{item.deptId}
		</foreach>
		and   to_days(r.create_time) <![CDATA[ <= ]]> to_days(#{datetime}) group by r.dept_id ) as temp
		where m.create_time = temp.create_time and m.dept_id = temp.dept_id

代码100分

 

select count(*) as rys ,
sum( case  when binglileixing  = “XX人员”  then 1 else 0 end) as mjry ,  
sum( case  when isMeetCondition  = 1  then 1 else 0 end) as glqwmry  ,
sum( case  when photourl  is not null   then 1 else 0 end) as xczm
 from fgtb_tianbao  where lid in (76,77) 

对符合条件的 数据统计个数「终于解决」

 

 

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/9561.html

(0)
上一篇 2023-02-05
下一篇 2023-02-05

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注