leading-project/finereport/kanban/mobile/物业_mobile.sql

44 lines
2.1 KiB
MySQL
Raw Normal View History

2024-08-09 18:23:29 +08:00
-- 【月报事率】
select
incident_ym
, sum(response_timely_incident_num) / sum(incident_num) response_timely_rate
, sum(completed_incident_num) / sum(incident_num) completed_rate
, sum(completed_incident_num - completed_not_close_incident_num) / sum(incident_num) close_rate
, sum(follow_up_incident_num) / sum(incident_num) follow_up_rate
, sum(delay_incident_num) / sum(incident_num) delay_rate
, sum(delay_incident_num) delay_incident_num
, sum(follow_up_satisfied_incident_num) / sum(follow_up_incident_num) follow_up_satisfied_rate
, sum(follow_up_evaluate_incident_num) / sum(follow_up_incident_num) follow_up_satisfied_rate1 --
-- 回访满意量 / -- 回访量
, sum(tousu_close_incident_num) / sum(tousu_incident_num) tousu_close_rate
, sum(tousu_incident_num) tousu_incident_num
FROM dws_estate_incident_info_m
where left(incident_ym,4) = '${left(p_ym,4)}'
AND incident_ym <> DATE_FORMAT(CURDATE(), '%Y%m')
${IF(LEN(p_area)>0," AND organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
group by incident_ym
order by incident_ym
follow_up_satisfied_rate, EXACT(
incident_ym,
CONCATENATE(
year(TODAY()), -- 当前年
if(
LEN(month(today())-1) = 1, --
CONCATENATE("0",month(today())-1),
month(today())-1
)
)
)
EXACT(text1,text2):EXACT函数返回TRUEFALSEEXACT函数可以区分大小写EXACT函数来检测输入文档的文字
Text1:
Text2:
:
EXACT("Spreadsheet","Spreadsheet")TRUE
EXACT("Spreadsheet","S preadsheet")FALSE
EXACT("Spreadsheet","spreadsheet")FALSE