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.
 
 
 
 
 
 

97 lines
6.7 KiB

-- 工资部分数据
select
ifnull(S0203,'') ,
ifnull(S0201,'') ,
'-' ,
'-' ,
'-' ,
'-' ,
'-' ,
'-' ,
ifnull((select min(code_name) from code_value where S0225=code_value and code_type='M_D_C11'),'') ,
'-' ,
'-' ,
ifnull((select min(code_name) from code_value where S0204=code_value and code_type='M_D_S0204'),'') ,
'-' ,
ifnull((select min(code_name) from code_value where S0205=code_value and code_type='ZB148'),'') ,
'-' ,
'-' 2,
'-' 2023,
'-' ,
'-' 2024
from m_s02 where rpt='2024' union all
select
ifnull(S0403,'') ,
ifnull(S0401,'') ,
'-' ,
'-' ,
'-' ,
'-' ,
'-' ,
'-' ,
ifnull((select min(code_name) from code_value where S0425=code_value and code_type='M_D_C11'),'') ,
'-' ,
'-' ,
ifnull((select min(code_name) from code_value where S0404=code_value and code_type='M_D_S0204'),'') ,
'-' ,
ifnull((select min(code_name) from code_value where S0405=code_value and code_type='ZB148'),'') ,
'-' ,
'-' 2,
'-' 2023,
'-' ,
'-' 2024
from m_s04 where rpt='2024';
-- 中间部分数据
select
ifnull(M0203,'') ,
ifnull(M0201,'') ,
ifnull(substr(M0204, 1, 6) ,'') ,
IF(M0202 = 1, '', '') ,
ifnull((select min(code_name) from code_value where M0205=code_value and code_type='M_D_CM16'),'') ,
ifnull(substr(M0216, 1, 6) ,'') ,
ifnull((select min(code_name) from code_value where M0206=code_value and code_type='M_D_CD17'),'') ,
ifnull((select min(code_name) from code_value where M0242=code_value and code_type='M_D_C11'),'') ,
ifnull((select min(code_name) from code_value where M0212=code_value and code_type='M_D_C11'),'') ,
ifnull((select min(code_name) from code_value where M0213=code_value and code_type='M_D_C12'),'') ,
ifnull((select min(code_name) from code_value where M0246=code_value and code_type='M_D_M0246_1'),'') ,
ifnull((select min(code_name) from code_value where M0208=code_value and code_type='M_D_C32_2019'),'') ,
ifnull(substr(M0233, 1, 6) ,'') ,
ifnull((select min(code_name) from code_value where M0243=code_value and code_type='M_D_C31_2019'),'') ,
ifnull(substr(M0244, 1, 6) ,'') ,
IF(M0215 = 1, '', '') 2,
ifnull((select min(code_name) from code_value where M0251=code_value and code_type='M_D_C32_2021'),'') 2023,
ifnull((select case M0104 when 2 then '参照管理机关工作人员' when 3 then '参照管理事业单位人员' else '公务员' end from M_M01 where M_M01.UNID=M_M02.UNID and rpt='2024' limit 1),'') ,
ifnull((select IF(M0525 = 1, '', '') from M_M05 where M0503=M0203 and rpt='2024' limit 1), '') 2024
from M_M02 where rpt='2024';
-- 基础部分数据
select
ifnull(A0184,'') ,
ifnull(A0101,'') ,
ifnull(substr(a0107, 1, 6),'') ,
IF(A0104 = 1, '', '') ,
ifnull((select min(code_name) from code_value where A0117=code_value and code_type='GB3304'),'') ,
ifnull(substr(a0134, 1, 6),'') ,
ifnull((select min(code_name) from code_value where A0141=code_value and code_type='GB4762'),'') ,
ifnull((select case when A0801B like '1%' then '研究生' when A0801B like '2%' then '大学本科' when A0801B like '3%' then '大学专科' else '中专及以下' end
from A08 where A0831=1 and A01.A0000=A08.A0000 limit 1), '') ,
ifnull((select case when A0801B like '1%' then '研究生' when A0801B like '2%' then '大学本科' when A0801B like '3%' then '大学专科' else '中专及以下' end
from A08 where A0834=1 and A01.A0000=A08.A0000 limit 1), '') ,
ifnull((select case when A0901B like '3%' then '硕士' when A0901B like '4%' then '学士' else '博士' end from A08 where A0835=1 and A01.A0000=A08.A0000 limit 1), '') ,
ifnull((select min(code_name) from code_value where A0123=code_value and code_type='XZ93'),'') ,
ifnull((select min(code_name) from A05, code_value where A0501B=code_value and code_type='ZB09' and A0531=0 and A0524=1 and A01.A0000=A05.A0000), '') ,
ifnull((select substr(A0504, 1, 6) from A05 where A0531=0 and A0524=1 and A01.A0000=A05.A0000), '') ,
ifnull((select min(code_name) from A05, code_value where A0501B=code_value and code_type='ZB148' and A0531=1 and A0524=1 and A01.A0000=A05.A0000), '') ,
ifnull((select ifnull(DATE_FORMAT(DATE_ADD(concat(substr(A0530, 1, 4),'-',substr(A0530, 5, 2),'-01'), INTERVAL ifnull(A0532, 0) MONTH), '%Y%m'),
ifnull(substr(A0504, 1, 6), '')) from A05 where A0531=1 and A0524=1 and A01.A0000=A05.A0000 limit 1), '') ,
IF(A0197 = 1, '', '') 2,
ifnull((select min(code_name) from A15, code_value where A1517=code_value and code_type='ZB18' and A1521='2023' and A01.A0000=A15.A0000), '') 2023,
ifnull((select min(code_name) from code_value where A0160=code_value and code_type='ZB125'),'') ,
ifnull((select '' from A99Z1 where A99Z101=1 and A99Z103=1 and A99Z102 like '2024%' and A01.A0000=A99Z1.A0000 limit 1), '') 2024
from A01 where A0163='1';