You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

22 lines
628 B

-- cim-查询执法人员视图
create view view_area_legal_officer AS
select
T1.code ,
t1.area_code ,
t1.name,
t2.CD_TIME,
count(t2.Y201000) as zfrys
from dashboard_area_info t1
inner join (
SELECT t1.*
FROM s_gdsztk_y2020_jb2 t1
INNER JOIN (
SELECT Y202000, MAX(CD_TIME) AS max_cd_time
FROM s_gdsztk_y2020_jb2
WHERE y202006 = '01'
GROUP BY Y202000
) t2 ON t1.Y202000 = t2.Y202000 AND t1.CD_TIME = t2.max_cd_time
WHERE t1.y202006 = '01'
ORDER BY t1.Y202000
) t2 on t1.area_code = t2.OPT_AREA_CODE COLLATE utf8mb4_0900_ai_ci and t1.`level` ='3'
group by T1.code ,t1.area_code ,t1.name,t2.CD_TIME;