This commit is contained in:
Ruslan 2025-01-23 10:28:54 +03:00
parent 9e668e5e93
commit e7bfc585fb
8 changed files with 766 additions and 1956 deletions

View file

@ -254,35 +254,35 @@
<hop>
<from>job_recruitments_region.hwf</from>
<to>job_recruitments_mildis.hwf</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>job_ratings.hwf</from>
<to>Success 3</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>job_recruitments_region.hwf</from>
<to>job_ratings.hwf</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>job_recruitments_mildis.hwf</from>
<to>job_recruitments_country.hwf</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>job_recruitments_country.hwf</from>
<to>Success 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
@ -296,14 +296,14 @@
<hop>
<from>add_schema.hpl</from>
<to>job_recruitments_region.hwf</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>add_schema.hpl</from>
<to>Success</to>
<enabled>N</enabled>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>

View file

@ -1,10 +1,10 @@
2025/01/21 17:00:40 - main_dashboard.total_registered(m_c).hpl - Using run configuration [local]
2025/01/21 17:00:40 - main_dashboard.total_registered(m_c) - Executing this pipeline using the Local Pipeline Engine with run configuration 'local'
2025/01/21 17:00:40 - main_dashboard.total_registered(m_c) - Execution started for pipeline [main_dashboard.total_registered(m_c)]
2025/01/21 17:00:40 - Execute SQL script.0 - Finished reading query, closing connection.
2025/01/21 17:00:40 - Execute SQL script.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0)
2025/01/21 17:00:40 - Table input (person_registry) регион.0 - Finished reading query, closing connection.
2025/01/21 17:00:40 - Table input (person_registry) регион.0 - Finished processing (I=158, O=0, R=0, W=158, U=0, E=0)
2025/01/21 17:00:41 - Insert / update (main_dashboard.total_registered) 2.0 - Finished processing (I=158, O=0, R=158, W=158, U=0, E=0)
2025/01/21 17:00:41 - main_dashboard.total_registered(m_c) - Pipeline duration : 0.585 seconds [ 0.585" ]
2025/01/21 17:00:41 - main_dashboard.total_registered(m_c) - Execution finished on a local pipeline engine with run configuration 'local'
2025/01/23 09:53:46 - main_dashboard.total_registered(m_c).hpl - Using run configuration [local]
2025/01/23 09:53:46 - main_dashboard.total_registered(m_c) - Executing this pipeline using the Local Pipeline Engine with run configuration 'local'
2025/01/23 09:53:46 - main_dashboard.total_registered(m_c) - Execution started for pipeline [main_dashboard.total_registered(m_c)]
2025/01/23 09:53:47 - Execute SQL script.0 - Finished reading query, closing connection.
2025/01/23 09:53:47 - Execute SQL script.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0)
2025/01/23 09:53:47 - Table input (person_registry) регион.0 - Finished reading query, closing connection.
2025/01/23 09:53:47 - Table input (person_registry) регион.0 - Finished processing (I=158, O=0, R=0, W=158, U=0, E=0)
2025/01/23 09:54:13 - Insert / update (main_dashboard.total_registered) 2.0 - Finished processing (I=158, O=158, R=158, W=158, U=0, E=0)
2025/01/23 09:54:13 - main_dashboard.total_registered(m_c) - Pipeline duration : 26.803 seconds [ 26.803" ]
2025/01/23 09:54:13 - main_dashboard.total_registered(m_c) - Execution finished on a local pipeline engine with run configuration 'local'

View file

@ -0,0 +1,71 @@
2025/01/22 15:40:31 - job_recruitments_milcom - Start of workflow execution
2025/01/22 15:40:31 - job_recruitments_milcom - Starting action [array_recruitments.hpl]
2025/01/22 15:40:31 - array_recruitments.hpl - Using run configuration [local]
2025/01/22 15:40:31 - array_recruitments - Executing this pipeline using the Local Pipeline Engine with run configuration 'local'
2025/01/22 15:40:31 - array_recruitments - Execution started for pipeline [array_recruitments]
2025/01/22 15:40:32 - Table input.0 - Finished reading query, closing connection.
2025/01/22 15:40:32 - Table input.0 - Finished processing (I=1, O=0, R=0, W=1, U=0, E=0)
2025/01/22 15:40:32 - Copy rows to result.0 - Finished processing (I=0, O=0, R=1, W=1, U=0, E=0)
2025/01/22 15:40:32 - array_recruitments - Pipeline duration : 0.388 seconds [ 0.388" ]
2025/01/22 15:40:32 - array_recruitments - Execution finished on a local pipeline engine with run configuration 'local'
2025/01/22 15:40:32 - job_recruitments_milcom - Starting action [total_registered.reg_mil_cat(m_c).hpl]
2025/01/22 15:40:32 - total_registered.reg_mil_cat(m_c).hpl - Using run configuration [local]
2025/01/22 15:40:32 - total_registered.reg_mil_cat(m_c) - Executing this pipeline using the Local Pipeline Engine with run configuration 'local'
2025/01/22 15:40:32 - total_registered.reg_mil_cat(m_c) - Execution started for pipeline [total_registered.reg_mil_cat(m_c)]
2025/01/22 15:40:32 - Execute SQL script.0 - Finished reading query, closing connection.
2025/01/22 15:40:32 - Execute SQL script.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0)
2025/01/22 15:40:32 - Table input (person_registry) военком/рег.0 - Finished reading query, closing connection.
2025/01/22 15:40:32 - Table input (person_registry) военком/рег.0 - Finished processing (I=316, O=0, R=0, W=316, U=0, E=0)
2025/01/22 15:40:42 - Insert / update (total_registered.reg_mil_cat).0 - Finished processing (I=316, O=4, R=316, W=316, U=0, E=0)
2025/01/22 15:40:42 - total_registered.reg_mil_cat(m_c) - Pipeline duration : 10.557 seconds [ 10.557" ]
2025/01/22 15:40:42 - total_registered.reg_mil_cat(m_c) - Execution finished on a local pipeline engine with run configuration 'local'
2025/01/22 15:40:42 - job_recruitments_milcom - Starting action [Success 7]
2025/01/22 15:40:42 - job_recruitments_milcom - Finished action [Success 7] (result=[true])
2025/01/22 15:40:42 - job_recruitments_milcom - Finished action [total_registered.reg_mil_cat(m_c).hpl] (result=[true])
2025/01/22 15:40:42 - job_recruitments_milcom - Starting action [total_registered.subpoenas(m_c).hpl]
2025/01/22 15:40:42 - total_registered.subpoenas(m_c).hpl - Using run configuration [local]
2025/01/22 15:40:42 - total_registered.subpoenas(m_c) - Executing this pipeline using the Local Pipeline Engine with run configuration 'local'
2025/01/22 15:40:42 - total_registered.subpoenas(m_c) - Execution started for pipeline [total_registered.subpoenas(m_c)]
2025/01/22 15:40:42 - Execute SQL script.0 - Finished reading query, closing connection.
2025/01/22 15:40:42 - Execute SQL script.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0)
2025/01/22 15:40:43 - Table input (subpoena) регион/рег.0 - Finished reading query, closing connection.
2025/01/22 15:40:43 - Table input (subpoena) регион/рег.0 - Finished processing (I=316, O=0, R=0, W=316, U=0, E=0)
2025/01/22 15:40:43 - Get variables 4 2.0 - Finished processing (I=0, O=0, R=316, W=316, U=0, E=0)
2025/01/22 15:40:43 - Select values 4 2.0 - Finished processing (I=0, O=0, R=316, W=316, U=0, E=0)
2025/01/22 15:40:58 - Insert / update (total_registered.subpoenas) 3.0 - Finished processing (I=316, O=316, R=316, W=316, U=0, E=0)
2025/01/22 15:40:58 - total_registered.subpoenas(m_c) - Pipeline duration : 15.525 seconds [ 15.525" ]
2025/01/22 15:40:58 - total_registered.subpoenas(m_c) - Execution finished on a local pipeline engine with run configuration 'local'
2025/01/22 15:40:58 - job_recruitments_milcom - Starting action [Success 9]
2025/01/22 15:40:58 - job_recruitments_milcom - Finished action [Success 9] (result=[true])
2025/01/22 15:40:58 - job_recruitments_milcom - Finished action [total_registered.subpoenas(m_c).hpl] (result=[true])
2025/01/22 15:40:58 - job_recruitments_milcom - Starting action [total_registered.driver_license(m_c).hpl]
2025/01/22 15:40:58 - total_registered.driver_license(m_c).hpl - Using run configuration [local]
2025/01/22 15:40:58 - total_registered.driver_license(m_c) - Executing this pipeline using the Local Pipeline Engine with run configuration 'local'
2025/01/22 15:40:58 - total_registered.driver_license(m_c) - Execution started for pipeline [total_registered.driver_license(m_c)]
2025/01/22 15:41:00 - Execute SQL script.0 - Finished reading query, closing connection.
2025/01/22 15:41:00 - Execute SQL script.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0)
2025/01/22 15:41:00 - Table input (driver_license) регионы/все.0 - Finished reading query, closing connection.
2025/01/22 15:41:00 - Table input (driver_license) регионы/все.0 - Finished processing (I=474, O=0, R=0, W=474, U=0, E=0)
2025/01/22 15:41:21 - Insert / update (total_registered.driver_license) 2.0 - Finished processing (I=474, O=474, R=474, W=474, U=0, E=0)
2025/01/22 15:41:21 - total_registered.driver_license(m_c) - Pipeline duration : 23.206 seconds [ 23.205" ]
2025/01/22 15:41:21 - total_registered.driver_license(m_c) - Execution finished on a local pipeline engine with run configuration 'local'
2025/01/22 15:41:21 - job_recruitments_milcom - Starting action [Success 10]
2025/01/22 15:41:21 - job_recruitments_milcom - Finished action [Success 10] (result=[true])
2025/01/22 15:41:21 - job_recruitments_milcom - Finished action [total_registered.driver_license(m_c).hpl] (result=[true])
2025/01/22 15:41:21 - job_recruitments_milcom - Starting action [total_registered.age(m_c).hpl]
2025/01/22 15:41:21 - total_registered.age(m_c).hpl - Using run configuration [local]
2025/01/22 15:41:21 - total_registered.age(m_c) - Executing this pipeline using the Local Pipeline Engine with run configuration 'local'
2025/01/22 15:41:21 - total_registered.age(m_c) - Execution started for pipeline [total_registered.age(m_c)]
2025/01/22 15:41:21 - Execute SQL script.0 - Finished reading query, closing connection.
2025/01/22 15:41:21 - Execute SQL script.0 - Finished processing (I=0, O=0, R=0, W=1, U=0, E=0)
2025/01/22 15:41:22 - Table input (person_registry) регион/мужчины.0 - Finished reading query, closing connection.
2025/01/22 15:41:22 - Table input (person_registry) регион/мужчины.0 - Finished processing (I=1264, O=0, R=0, W=1264, U=0, E=0)
2025/01/22 15:42:11 - Insert / update (total_registered.age) 2.0 - Finished processing (I=1264, O=948, R=1264, W=1264, U=0, E=0)
2025/01/22 15:42:11 - total_registered.age(m_c) - Pipeline duration : 50.097 seconds [ 50.097" ]
2025/01/22 15:42:11 - total_registered.age(m_c) - Execution finished on a local pipeline engine with run configuration 'local'
2025/01/22 15:42:11 - job_recruitments_milcom - Starting action [Success 12]
2025/01/22 15:42:11 - job_recruitments_milcom - Finished action [Success 12] (result=[true])
2025/01/22 15:42:11 - job_recruitments_milcom - Finished action [total_registered.age(m_c).hpl] (result=[true])
2025/01/22 15:42:11 - job_recruitments_milcom - Finished action [array_recruitments.hpl] (result=[true])
2025/01/22 15:42:11 - job_recruitments_milcom - Workflow execution finished
2025/01/22 15:42:11 - job_recruitments_milcom - Workflow duration : 99.818 seconds [ 1' 39.817" ]

View file

@ -458,15 +458,11 @@
<filename>${PROJECT_HOME}/mil_com/total_registered.child_minor(m_c).hpl</filename>
<logext>txt</logext>
<logfile>C:\Users\acer\Desktop\лог</logfile>
<loglevel>Basic</loglevel>
<loglevel>Rowlevel</loglevel>
<parameters>
<parameter>
<name>SCM</name>
<stream_name>SCHEMA</stream_name>
</parameter>
<parameter>
<name>REC_ID</name>
<stream_name>RECRUITMENT_ID</stream_name>
<name>ARR_MC</name>
<stream_name>ARRAY_MIL_COM</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
@ -476,7 +472,7 @@
<set_logfile>Y</set_logfile>
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>1088</xloc>
<xloc>1360</xloc>
<yloc>640</yloc>
<attributes_hac/>
</action>
@ -486,7 +482,7 @@
<type>SUCCESS</type>
<attributes/>
<parallel>N</parallel>
<xloc>1296</xloc>
<xloc>1568</xloc>
<yloc>640</yloc>
<attributes_hac/>
</action>
@ -505,12 +501,8 @@
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>SCM</name>
<stream_name>SCHEMA</stream_name>
</parameter>
<parameter>
<name>REC_ID</name>
<stream_name>RECRUITMENT_ID</stream_name>
<name>ARR_MC</name>
<stream_name>ARRAY_MIL_COM</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
@ -521,7 +513,7 @@
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>1088</xloc>
<yloc>1840</yloc>
<yloc>704</yloc>
<attributes_hac/>
</action>
<action>
@ -531,7 +523,7 @@
<attributes/>
<parallel>N</parallel>
<xloc>1296</xloc>
<yloc>1840</yloc>
<yloc>704</yloc>
<attributes_hac/>
</action>
<action>
@ -549,12 +541,8 @@
<loglevel>Basic</loglevel>
<parameters>
<parameter>
<name>SCM</name>
<stream_name>SCHEMA</stream_name>
</parameter>
<parameter>
<name>REC_ID</name>
<stream_name>RECRUITMENT_ID</stream_name>
<name>ARR_MC</name>
<stream_name>ARRAY_MIL_COM</stream_name>
</parameter>
<pass_all_parameters>Y</pass_all_parameters>
</parameters>
@ -565,7 +553,7 @@
<wait_until_finished>Y</wait_until_finished>
<parallel>N</parallel>
<xloc>1088</xloc>
<yloc>1920</yloc>
<yloc>768</yloc>
<attributes_hac/>
</action>
<action>
@ -575,7 +563,7 @@
<attributes/>
<parallel>N</parallel>
<xloc>1296</xloc>
<yloc>1920</yloc>
<yloc>768</yloc>
<attributes_hac/>
</action>
<action>
@ -839,14 +827,14 @@
<hop>
<from>Start</from>
<to>select_recruitments_milcom(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>Y</unconditional>
</hop>
<hop>
<from>select_recruitments_milcom(m_c).hpl</from>
<to>main_dashboard.recruitment_campaign(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
@ -867,7 +855,7 @@
<hop>
<from>select_recruitments_milcom(m_c).hpl</from>
<to>recruitment_campaign.subpoenas(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
@ -902,42 +890,42 @@
<hop>
<from>select_recruitments_milcom(m_c).hpl</from>
<to>total_registered.child_minor(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>select_recruitments_milcom(m_c).hpl</from>
<to>total_registered.age(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>select_recruitments_milcom(m_c).hpl</from>
<to>total_registered.marital_status(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>select_recruitments_milcom(m_c).hpl</from>
<to>total_registered.education_level(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>select_recruitments_milcom(m_c).hpl</from>
<to>total_registered.busyness(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>select_recruitments_milcom(m_c).hpl</from>
<to>recruitment_campaign.appeals(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
@ -958,49 +946,49 @@
<hop>
<from>array_recruitments.hpl</from>
<to>main_dashboard.appeals(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>array_recruitments.hpl</from>
<to>main_dashboard.total_registered(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>array_recruitments.hpl</from>
<to>main_dashboard.waiting_registration(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>array_recruitments.hpl</from>
<to>total_registered.reg_mil_cat(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>array_recruitments.hpl</from>
<to>total_registered.removed_registry(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>array_recruitments.hpl</from>
<to>total_registered.subpoenas(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>array_recruitments.hpl</from>
<to>total_registered.driver_license(m_c).hpl</to>
<enabled>Y</enabled>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
@ -1011,8 +999,49 @@
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>array_recruitments.hpl</from>
<to>total_registered.age(m_c).hpl</to>
<enabled>N</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
<hop>
<from>array_recruitments.hpl</from>
<to>total_registered.marital_status(m_c).hpl</to>
<enabled>Y</enabled>
<evaluation>Y</evaluation>
<unconditional>N</unconditional>
</hop>
</hops>
<notepads>
<notepad>
<backgroundcolorblue>251</backgroundcolorblue>
<backgroundcolorgreen>232</backgroundcolorgreen>
<backgroundcolorred>201</backgroundcolorred>
<bordercolorblue>90</bordercolorblue>
<bordercolorgreen>58</bordercolorgreen>
<bordercolorred>14</bordercolorred>
<fontbold>N</fontbold>
<fontcolorblue>90</fontcolorblue>
<fontcolorgreen>58</fontcolorgreen>
<fontcolorred>14</fontcolorred>
<fontitalic>N</fontitalic>
<fontname>Segoe UI</fontname>
<fontsize>9</fontsize>
<height>137</height>
<xloc>1488</xloc>
<yloc>1072</yloc>
<note>total_registered.child_minor - доработать (отложил)
total_registered.marital_status - доработать (в процессе)
main_dashboard.recruitment_campaign - продумать разделение весна /осень, доработать под массивы и обьединить
recruitment_campaign.subpoena - продумать разделение весна /осень, доработать под массивы и обьединить
total_registered.education_level - доработать под массивы и обьединить
total_registered.busyness - доработать под массивы и обьединить
recruitment_campaign.appeals - продумать разделение весна /осень, доработать под массивы и обьединить
</note>
<width>652</width>
</notepad>
</notepads>
<attributes>
<group>

View file

@ -60,6 +60,11 @@
<to>Insert / update (total_registered.child_minor)</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input</from>
<to>Insert / update (total_registered.age)</to>
<enabled>Y</enabled>
</hop>
</order>
<transform>
<name>Insert / update (main_dashboard.appeals)</name>
@ -208,6 +213,55 @@
<yloc>208</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update (total_registered.age)</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruitment_id</field>
<name>recruitment_id</name>
</key>
<key>
<condition>=</condition>
<field>recording_date</field>
<name>recording_date</name>
</key>
<schema>total_registered</schema>
<table>age</table>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>schema</name>
<rename>schema</rename>
<update>Y</update>
</value>
<value>
<name>recording_date</name>
<rename>recording_date</rename>
<update>N</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1040</xloc>
<yloc>688</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update (total_registered.child_minor)</name>
<type>InsertUpdate</type>
@ -474,7 +528,7 @@
WHEN schema = 'Department' THEN 'Department'
WHEN schema = 'Organization' THEN 'REG_LVL'
WHEN schema = 'Region' THEN 'MD_LVL'
--WHEN schema = 'Ministry' THEN 'Ministry'
WHEN schema = 'Ministry' THEN 'Ministry'
ELSE schema -- на случай, если появится неизвестное значение
END AS schema,
current_date AS recording_date
@ -484,8 +538,8 @@ WHERE schema in ('Department', 'Organization', 'Region') </sql>
<variables_active>N</variables_active>
<attributes/>
<GUI>
<xloc>608</xloc>
<yloc>528</yloc>
<xloc>544</xloc>
<yloc>688</yloc>
</GUI>
</transform>
<transform_error_handling>

View file

@ -24,42 +24,42 @@
<hop>
<from>Get variables 4 2</from>
<to>Select values 4 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry)регион/все</from>
<to>Get variables 4 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 4 2 2</from>
<to>Select values 4 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 2 2</from>
<to>Insert / update (total_registered.child_minor) 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 4 2 2 2</from>
<to>Select values 4 2 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 2 2 2</from>
<to>Insert / update (total_registered.child_minor) 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry)РФ/мужчины</from>
<to>Get variables 4 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry)РФ/женщины</from>
<to>Get variables 4 2 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Execute SQL script</from>
@ -69,16 +69,21 @@
<hop>
<from>Execute SQL script</from>
<to>Table input (person_registry)РФ/мужчины</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Execute SQL script</from>
<to>Table input (person_registry)РФ/женщины</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 4 2</from>
<to>Insert / update (total_registered.child_minor) 3</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry)регион/все</from>
<to>Insert / update (total_registered.child_minor) 3</to>
<enabled>Y</enabled>
</hop>
</order>
@ -96,19 +101,15 @@
<arguments>
</arguments>
<connection>ervu-dashboard</connection>
<delete_field/>
<execute_each_row>N</execute_each_row>
<insert_field/>
<quoteString>N</quoteString>
<read_field/>
<replace_variables>Y</replace_variables>
<set_params>N</set_params>
<single_statement>N</single_statement>
<sql>DELETE FROM total_registered.child_minor
WHERE recording_date = current_date
AND schema IN ('Department', 'MD_LVL', 'REG_LVL')
AND recruitment_id = '${REC_ID}'</sql>
<update_field/>
</sql>
<attributes/>
<GUI>
<xloc>576</xloc>
@ -145,7 +146,7 @@ WHERE recording_date = current_date
<attributes/>
<GUI>
<xloc>1056</xloc>
<yloc>368</yloc>
<yloc>480</yloc>
</GUI>
</transform>
<transform>
@ -422,6 +423,105 @@ WHERE recording_date = current_date
<yloc>704</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update (total_registered.child_minor) 3</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruitment_id</field>
<name>recruitment_id</name>
</key>
<key>
<condition>=</condition>
<field>recording_date</field>
<name>recording_date</name>
</key>
<schema>total_registered</schema>
<table>child_minor</table>
<value>
<name>no_child</name>
<rename>no_children</rename>
<update>Y</update>
</value>
<value>
<name>"1_child"</name>
<rename>one_child</rename>
<update>Y</update>
</value>
<value>
<name>"2_child"</name>
<rename>two_children</rename>
<update>Y</update>
</value>
<value>
<name>"3_child"</name>
<rename>three_children</rename>
<update>Y</update>
</value>
<value>
<name>"4_more_child"</name>
<rename>four_or_more_children</rename>
<update>Y</update>
</value>
<value>
<name>"all_M_W"</name>
<rename>gender</rename>
<update>N</update>
</value>
<value>
<name>no_child_percent</name>
<rename>no_children_percent</rename>
<update>Y</update>
</value>
<value>
<name>"1_child_percent"</name>
<rename>one_child_percent</rename>
<update>Y</update>
</value>
<value>
<name>"2_child_percent"</name>
<rename>two_children_percent</rename>
<update>Y</update>
</value>
<value>
<name>"3_child_percent"</name>
<rename>three_children_percent</rename>
<update>Y</update>
</value>
<value>
<name>"4_more_child_percent"</name>
<rename>four_or_more_children_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>total_count</name>
<rename>total_count</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1504</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform>
<name>Select values 4 2</name>
<type>SelectValues</type>
@ -473,7 +573,7 @@ WHERE recording_date = current_date
<attributes/>
<GUI>
<xloc>1248</xloc>
<yloc>368</yloc>
<yloc>480</yloc>
</GUI>
</transform>
<transform>
@ -800,18 +900,51 @@ FROM
<connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>WITH extracted_children AS (
<sql>WITH
ids AS (
SELECT unnest(string_to_array(trim(both '{}' from '${ARR_MC}'), ','))::uuid AS recruitment_id
),
gender_separations AS (
SELECT 'MALE' AS gender
UNION ALL
SELECT 'FEMALE' AS gender
),
data_combinations AS (
-- Создаём все комбинации target_recruitment_id и gender
SELECT
i.recruitment_id AS recruitment_id,
gs.gender
FROM ids i
CROSS JOIN gender_separations gs
),
base_data AS (
SELECT
ri.recruit_id,
r.target_recruitment_id AS recruitment_id,
r.gender,
jsonb_array_elements_text(ri.info->'svedDeti'->'rebenok') AS child
FROM
public.recruits_info ri
JOIN public.recruits r ON ri.recruit_id = r.id
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE
jsonb_typeof(ri.info->'svedDeti'->'rebenok') = 'array'
AND r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id = '${REC_ID}'
AND r.target_recruitment_id::uuid IN (SELECT recruitment_id FROM ids)
AND r.gender IN ('MALE', 'FEMALE')
order by ri.recruit_id, r.gender, ri.info
),
extracted_children AS (
SELECT
ri.recruit_id,
jsonb_array_elements_text(ri.info->'svedDeti'->'rebenok') AS child
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE
jsonb_typeof(ri.info->'svedDeti'->'rebenok') = 'array'
AND r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id IS NOT NULL
AND r.gender IN ('MALE', 'FEMALE')
),
children_birth_dates AS (
SELECT
@ -829,46 +962,115 @@ children_count AS (
FROM
children_birth_dates
WHERE
AGE(make_date(year, month, day)) &lt; interval '18 years'
GROUP BY
recruit_id
make_date(year, month, day) > CURRENT_DATE - INTERVAL '18 years'
GROUP BY recruit_id
),
final_counts AS (
SELECT
dc.recruitment_id,
CASE
WHEN dc.gender = 'MALE' THEN 'M'
WHEN dc.gender = 'FEMALE' THEN 'W'
ELSE NULL
END AS gender,
COALESCE(children_under_18, 0) AS children_count,
COUNT(*) AS num_people
FROM
public.recruits_info ri
LEFT JOIN
children_count cc ON ri.recruit_id = cc.recruit_id
JOIN public.recruits r ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id = '${REC_ID}'
FROM data_combinations dc
LEFT JOIN base_data bd ON bd.recruitment_id = dc.recruitment_id AND bd.gender = dc.gender
LEFT JOIN children_count cc ON bd.recruit_id = cc.recruit_id
GROUP BY
COALESCE(children_under_18, 0)
dc.recruitment_id, dc.gender, COALESCE(children_under_18, 0)
),
total_people AS (
SELECT SUM(num_people) AS total_count
FROM final_counts
final_counts_all AS (
SELECT
dc.recruitment_id,
'ALL' AS gender,
COALESCE(children_under_18, 0) AS children_count,
COUNT(*) AS num_people
FROM data_combinations dc
LEFT JOIN base_data bd ON bd.recruitment_id = dc.recruitment_id AND bd.gender = dc.gender
LEFT JOIN children_count cc ON bd.recruit_id = cc.recruit_id
GROUP BY
dc.recruitment_id, COALESCE(children_under_18, 0)
),
total_count AS (
SELECT
CASE
WHEN dc.gender = 'MALE' THEN 'M'
WHEN dc.gender = 'FEMALE' THEN 'W'
ELSE NULL
END AS gender,
dc.recruitment_id,
COUNT(*) AS total_count
FROM data_combinations dc
LEFT JOIN base_data bd ON bd.recruitment_id = dc.recruitment_id AND bd.gender = dc.gender
LEFT JOIN children_count cc ON bd.recruit_id = cc.recruit_id
GROUP BY dc.gender, dc.recruitment_id
),
total_count_all AS (
SELECT
'ALL' AS gender,
dc.recruitment_id,
COUNT(*) AS total_count
FROM data_combinations dc
LEFT JOIN base_data bd ON bd.recruitment_id = dc.recruitment_id AND bd.gender = dc.gender
LEFT JOIN children_count cc ON bd.recruit_id = cc.recruit_id
GROUP BY dc.recruitment_id
),
final_data AS (
SELECT
fc.gender,
fc.recruitment_id,
tc.total_count,
fc.children_count,
fc.num_people
FROM
final_counts fc
JOIN total_count tc ON fc.recruitment_id = tc.recruitment_id AND fc.gender = tc.gender
WHERE fc.gender = 'M'
UNION ALL
SELECT
fc.gender,
fc.recruitment_id,
tc.total_count,
fc.children_count,
fc.num_people
FROM
final_counts fc
JOIN total_count tc ON fc.recruitment_id = tc.recruitment_id AND fc.gender = tc.gender
WHERE fc.gender = 'W'
UNION ALL
SELECT
'ALL' AS gender,
fca.recruitment_id,
tca.total_count,
fca.children_count,
fca.num_people
FROM
final_counts_all fca
JOIN total_count_all tca ON fca.recruitment_id = tca.recruitment_id
)
SELECT
'ALL' AS gender,
'${REC_ID}' as recruitment_id,
'${SCM}' AS schema,
(SELECT total_count FROM total_people) AS total_count,
current_date AS recording_date,
gender,
recruitment_id,
total_count,
COALESCE(SUM(CASE WHEN children_count = 0 THEN num_people ELSE 0 END), 0) AS no_children,
COALESCE(SUM(CASE WHEN children_count = 1 THEN num_people ELSE 0 END), 0) AS one_child,
COALESCE(SUM(CASE WHEN children_count = 2 THEN num_people ELSE 0 END), 0) AS two_children,
COALESCE(SUM(CASE WHEN children_count = 3 THEN num_people ELSE 0 END), 0) AS three_children,
COALESCE(SUM(CASE WHEN children_count >= 4 THEN num_people ELSE 0 END), 0) AS four_or_more_children,
ROUND(COALESCE(SUM(CASE WHEN children_count = 0 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM total_people), 0), 2) AS no_children_percent,
ROUND(COALESCE(SUM(CASE WHEN children_count = 1 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM total_people), 0), 2) AS one_child_percent,
ROUND(COALESCE(SUM(CASE WHEN children_count = 2 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM total_people), 0), 2) AS two_children_percent,
ROUND(COALESCE(SUM(CASE WHEN children_count = 3 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM total_people), 0), 2) AS three_children_percent,
ROUND(COALESCE(SUM(CASE WHEN children_count >= 4 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM total_people), 0), 2) AS four_or_more_children_percent
FROM
final_counts;</sql>
ROUND(COALESCE(SUM(CASE WHEN children_count = 0 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM final_data), 0), 2) AS no_children_percent,
ROUND(COALESCE(SUM(CASE WHEN children_count = 1 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM final_data), 0), 2) AS one_child_percent,
ROUND(COALESCE(SUM(CASE WHEN children_count = 2 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM final_data), 0), 2) AS two_children_percent,
ROUND(COALESCE(SUM(CASE WHEN children_count = 3 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM final_data), 0), 2) AS three_children_percent,
ROUND(COALESCE(SUM(CASE WHEN children_count >= 4 THEN num_people ELSE 0 END), 0) * 100.0 / NULLIF((SELECT total_count FROM final_data), 0), 2) AS four_or_more_children_percent
FROM
final_data
GROUP BY gender, recruitment_id, total_count
</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>
@ -876,110 +1078,6 @@ FROM
<yloc>368</yloc>
</GUI>
</transform>
<transform>
<name>Insert / update (total_registered.child_minor) 3</name>
<type>InsertUpdate</type>
<description/>
<distribute>Y</distribute>
<custom_distribution/>
<copies>1</copies>
<partitioning>
<method>none</method>
<schema_name/>
</partitioning>
<commit>100</commit>
<connection>ervu-dashboard</connection>
<lookup>
<key>
<condition>=</condition>
<field>recruitment_id</field>
<name>REC_ID</name>
</key>
<key>
<condition>=</condition>
<field>schema</field>
<name>SCM</name>
</key>
<schema>total_registered</schema>
<table>child_minor</table>
<value>
<name>no_child</name>
<rename>no_children</rename>
<update>Y</update>
</value>
<value>
<name>"1_child"</name>
<rename>one_child</rename>
<update>Y</update>
</value>
<value>
<name>"2_child"</name>
<rename>two_children</rename>
<update>Y</update>
</value>
<value>
<name>"3_child"</name>
<rename>three_children</rename>
<update>Y</update>
</value>
<value>
<name>"4_more_child"</name>
<rename>four_or_more_children</rename>
<update>Y</update>
</value>
<value>
<name>"all_M_W"</name>
<rename>gender</rename>
<update>N</update>
</value>
<value>
<name>no_child_percent</name>
<rename>no_children_percent</rename>
<update>Y</update>
</value>
<value>
<name>"1_child_percent"</name>
<rename>one_child_percent</rename>
<update>Y</update>
</value>
<value>
<name>"2_child_percent"</name>
<rename>two_children_percent</rename>
<update>Y</update>
</value>
<value>
<name>"3_child_percent"</name>
<rename>three_children_percent</rename>
<update>Y</update>
</value>
<value>
<name>"4_more_child_percent"</name>
<rename>four_or_more_children_percent</rename>
<update>Y</update>
</value>
<value>
<name>recruitment_id</name>
<rename>recruitment_id</rename>
<update>N</update>
</value>
<value>
<name>schema</name>
<rename>schema</rename>
<update>N</update>
</value>
<value>
<name>total_count</name>
<rename>total_count</rename>
<update>Y</update>
</value>
</lookup>
<update_bypassed>N</update_bypassed>
<attributes/>
<GUI>
<xloc>1504</xloc>
<yloc>368</yloc>
</GUI>
</transform>
<transform_error_handling>
</transform_error_handling>
<attributes/>

View file

@ -24,52 +24,52 @@
<hop>
<from>Get variables 3 2</from>
<to>Select values 3 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 3 2 2</from>
<to>Select values 3 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) регионы/все</from>
<to>Get variables 3 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Get variables 3 2 2 2</from>
<to>Select values 3 2 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) регионы/мужчины</from>
<to>Get variables 3 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) регионы/женщины</from>
<to>Get variables 3 2 2 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 3 2</from>
<to>Insert / update (total_registered.marital_status) </to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 3 2 2</from>
<to>Insert / update (total_registered.marital_status) 2</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Select values 3 2 2 2</from>
<to>Insert / update (total_registered.marital_status) 3</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Execute SQL script</from>
<to>Table input (person_registry) регионы/все</to>
<enabled>Y</enabled>
<enabled>N</enabled>
</hop>
<hop>
<from>Execute SQL script</from>
@ -79,6 +79,11 @@
<hop>
<from>Execute SQL script</from>
<to>Table input (person_registry) регионы/женщины</to>
<enabled>N</enabled>
</hop>
<hop>
<from>Table input (person_registry) регионы/мужчины</from>
<to>Insert / update (total_registered.marital_status) 2</to>
<enabled>Y</enabled>
</hop>
</order>
@ -96,19 +101,15 @@
<arguments>
</arguments>
<connection>ervu-dashboard</connection>
<delete_field/>
<execute_each_row>N</execute_each_row>
<insert_field/>
<quoteString>N</quoteString>
<read_field/>
<replace_variables>Y</replace_variables>
<set_params>N</set_params>
<single_statement>N</single_statement>
<sql>DELETE FROM total_registered.marital_status
WHERE recording_date = current_date
AND schema IN ('Department', 'MD_LVL', 'REG_LVL')
AND recruitment_id = '${REC_ID}'</sql>
<update_field/>
AND schema IN ('Department', 'MD_LVL', 'REG_LVL', 'empty')
</sql>
<attributes/>
<GUI>
<xloc>752</xloc>
@ -178,7 +179,7 @@ WHERE recording_date = current_date
<attributes/>
<GUI>
<xloc>1280</xloc>
<yloc>544</yloc>
<yloc>624</yloc>
</GUI>
</transform>
<transform>
@ -305,12 +306,17 @@ WHERE recording_date = current_date
<key>
<condition>=</condition>
<field>recruitment_id</field>
<name>REC_ID</name>
<name>recruitment_id</name>
</key>
<key>
<condition>=</condition>
<field>schema</field>
<name>SCM</name>
<field>recording_date</field>
<name>recording_date</name>
</key>
<key>
<condition>=</condition>
<field>"all_M_W"</field>
<name>gender</name>
</key>
<schema>total_registered</schema>
<table>marital_status</table>
@ -349,11 +355,6 @@ WHERE recording_date = current_date
<rename>total</rename>
<update>Y</update>
</value>
<value>
<name>schema</name>
<rename>schema</rename>
<update>N</update>
</value>
</lookup>
<update_bypassed>Y</update_bypassed>
<attributes/>
@ -541,7 +542,7 @@ WHERE recording_date = current_date
<attributes/>
<GUI>
<xloc>1424</xloc>
<yloc>544</yloc>
<yloc>624</yloc>
</GUI>
</transform>
<transform>
@ -692,26 +693,81 @@ WHERE
<connection>ervu_person_registry</connection>
<execute_each_row>N</execute_each_row>
<limit>0</limit>
<sql>SELECT
COUNT(*) FILTER (WHERE ri.info->'svedSemPolozh'->>'semPolozhNaim' IN ('Вдова/Вдовец', 'В разводе') OR ri.info->'svedSemPolozh'->'semPolozhNaim' IS NULL) AS not_married,
COUNT(*) FILTER (WHERE ri.info->'svedSemPolozh'->>'semPolozhNaim' IN ('В браке')) AS married,
COUNT(*) AS total,
ROUND(COUNT(*) FILTER (WHERE ri.info->'svedSemPolozh'->>'semPolozhNaim' IN ('Вдова/Вдовец', 'В разводе') OR ri.info->'svedSemPolozh'->'semPolozhNaim' IS NULL) * 100.0 / NULLIF(COUNT(*), 0), 2) AS not_married_percent,
ROUND(COUNT(*) FILTER (WHERE ri.info->'svedSemPolozh'->>'semPolozhNaim' IN ('В браке')) * 100.0 / NULLIF(COUNT(*), 0), 2) AS married_percent,
'M' AS gender,
'${SCM}' AS schema,
'${REC_ID}' AS recruitment_id
FROM
public.recruits r
JOIN
public.recruits_info ri ON ri.recruit_id = r.id
WHERE
r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.gender = 'MALE'
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id = '${REC_ID}'
</sql>
<sql>WITH
ids AS (
SELECT unnest(string_to_array(trim(both '{}' from '${ARR_MC}'), ','))::uuid AS recruitment_id
),
gender_separations AS (
SELECT 'MALE' AS gender
UNION ALL
SELECT 'FEMALE' AS gender
),
data_combinations AS (
SELECT
i.recruitment_id AS recruitment_id,
gs.gender
FROM ids i
CROSS JOIN gender_separations gs
),
recruit_data AS (
SELECT
ri.info->'svedSemPolozh'->>'semPolozhNaim' AS sem_pol,
r.gender,
r.target_recruitment_id AS recruitment_id
FROM public.recruits r
LEFT JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.gender IN ('MALE', 'FEMALE')
AND r.current_recruitment_id IS NOT NULL
AND r.target_recruitment_id::uuid IN (SELECT recruitment_id FROM ids)
),
married_counts AS (
-- Считаем значения для каждого гендера
SELECT
dc.recruitment_id,
dc.gender,
COUNT(*) FILTER (WHERE rd.sem_pol IN ('Вдова/Вдовец', 'В разводе') OR rd.sem_pol IS NULL) AS not_married,
COUNT(*) FILTER (WHERE rd.sem_pol = 'В браке') AS married,
COUNT(*) AS total
FROM data_combinations dc
LEFT JOIN recruit_data rd
ON rd.recruitment_id = dc.recruitment_id
AND rd.gender = dc.gender
GROUP BY dc.recruitment_id, dc.gender
),
all_counts AS (
-- Считаем значения для ALL, суммируя данные по всем гендерам
SELECT
recruitment_id,
'ALL' AS gender,
SUM(not_married) AS not_married,
SUM(married) AS married,
SUM(total) AS total
FROM married_counts
GROUP BY recruitment_id
)
-- Финальное объединение
SELECT
mc.not_married,
mc.married,
mc.total,
ROUND(mc.not_married * 100.0 / NULLIF(mc.total, 0), 2) AS not_married_percent,
ROUND(mc.married * 100.0 / NULLIF(mc.total, 0), 2) AS married_percent,
mc.gender,
current_date AS recording_date,
mc.recruitment_id
FROM married_counts mc
UNION ALL
SELECT
ac.not_married,
ac.married,
ac.total,
ROUND(ac.not_married * 100.0 / NULLIF(ac.total, 0), 2) AS not_married_percent,
ROUND(ac.married * 100.0 / NULLIF(ac.total, 0), 2) AS married_percent,
ac.gender,
current_date AS recording_date,
ac.recruitment_id
FROM all_counts ac;</sql>
<variables_active>Y</variables_active>
<attributes/>
<GUI>