total_registered.age(reg)
Y
Normal
0
N
1000
100
-
2024/08/02 11:56:22.507
-
2024/08/02 11:56:22.507
Get variables 3 2
Select values 3 2
Y
Get variables 3 2 2
Select values 3 2 2
Y
Get variables 3 2 2 2
Select values 3 2 2 2
Y
Table input (person_registry) регион/все
Get variables 3 2
Y
Select values 3 2
Insert / update (total_registered.age)
Y
Table input (person_registry) регион/мужчины
Get variables 3 2 2
Y
Select values 3 2 2
Insert / update (total_registered.age) 2
Y
Table input (person_registry) регион/женщины
Get variables 3 2 2 2
Y
Select values 3 2 2 2
Insert / update (total_registered.age) 3
Y
Get variables 3 2 3
Select values 3 2 3
Y
Get variables 3 2 2 3
Select values 3 2 2 3
Y
Get variables 3 2 2 2 2
Select values 3 2 2 2 2
Y
Select values 3 2 3
Insert / update (total_registered.age) 4
Y
Select values 3 2 2 3
Insert / update (total_registered.age) 2 2
Y
Select values 3 2 2 2 2
Insert / update (total_registered.age) 3 2
Y
Table input (person_registry) регион/все 2
Get variables 3 2 3
Y
Table input (person_registry) регион/женщины 2
Get variables 3 2 2 2 2
Y
Table input (person_registry) регион/мужчины 2
Get variables 3 2 2 3
Y
Get variables 3 2
GetVariable
Y
1
none
-1
REG_ID
-1
none
String
-1
VK_ARRAY
-1
none
String
672
192
Get variables 3 2 2
GetVariable
Y
1
none
-1
REG_ID
-1
none
String
-1
VK_ARRAY
-1
none
String
672
352
Get variables 3 2 2 2
GetVariable
Y
1
none
-1
REG_ID
-1
none
String
-1
VK_ARRAY
-1
none
String
672
512
Get variables 3 2 2 2 2
GetVariable
Y
1
none
-1
REG_ID
-1
none
String
-1
VK_ARRAY
-1
none
String
656
1056
Get variables 3 2 2 3
GetVariable
Y
1
none
-1
REG_ID
-1
none
String
-1
VK_ARRAY
-1
none
String
656
896
Get variables 3 2 3
GetVariable
Y
1
none
-1
REG_ID
-1
none
String
-1
VK_ARRAY
-1
none
String
656
736
Insert / update (total_registered.age)
InsertUpdate
Y
1
none
100
ervu-dashboard
=
recruitment_id
REG_ID
total_registered
"17_years"
17_year_count
Y
"18-26_years"
18-26_year_count
Y
"27-30_years"
27-30_year_count
Y
"31-35_years"
31-35_year_count
Y
"36-40_years"
36-40_year_count
Y
"41-45_years"
41-45_year_count
Y
"51+_years"
41-45_year_count
Y
"all_M_W"
gender
N
"46-50_years"
46-50_year_count
Y
"17_years_percent"
17_year_percent
Y
"18-26_years_percent"
18-26_year_percent
Y
"27-30_years_percent"
27-30_year_percent
Y
"31-35_years_percent"
31-35_year_percent
Y
"36-40_years_percent"
36-40_year_percent
Y
"41-45_years_percent"
41-45_year_percent
Y
"46-50_years_percent"
46-50_year_percent
Y
"51+_years_percent"
51+_year_percent
Y
recruitment_id
recruitment_id
N
registered
registered
N
Y
1056
192
Insert / update (total_registered.age) 2
InsertUpdate
Y
1
none
100
ervu-dashboard
=
recruitment_id
REG_ID
total_registered
"17_years"
17_year_count
Y
"18-26_years"
18-26_year_count
Y
"27-30_years"
27-30_year_count
Y
"31-35_years"
31-35_year_count
Y
"36-40_years"
36-40_year_count
Y
"41-45_years"
41-45_year_count
Y
"51+_years"
41-45_year_count
Y
"all_M_W"
gender
N
"46-50_years"
46-50_year_count
Y
"17_years_percent"
17_year_percent
Y
"18-26_years_percent"
18-26_year_percent
Y
"27-30_years_percent"
27-30_year_percent
Y
"31-35_years_percent"
31-35_year_percent
Y
"36-40_years_percent"
36-40_year_percent
Y
"41-45_years_percent"
41-45_year_percent
Y
"46-50_years_percent"
46-50_year_percent
Y
"51+_years_percent"
51+_year_percent
Y
recruitment_id
recruitment_id
N
registered
registered
N
Y
1056
352
Insert / update (total_registered.age) 2 2
InsertUpdate
Y
1
none
100
ervu-dashboard
=
recruitment_id
REG_ID
total_registered
"17_years"
17_year_count
Y
"18-26_years"
18-26_year_count
Y
"27-30_years"
27-30_year_count
Y
"31-35_years"
31-35_year_count
Y
"36-40_years"
36-40_year_count
Y
"41-45_years"
41-45_year_count
Y
"51+_years"
41-45_year_count
Y
"all_M_W"
gender
N
"46-50_years"
46-50_year_count
Y
"17_years_percent"
17_year_percent
Y
"18-26_years_percent"
18-26_year_percent
Y
"27-30_years_percent"
27-30_year_percent
Y
"31-35_years_percent"
31-35_year_percent
Y
"36-40_years_percent"
36-40_year_percent
Y
"41-45_years_percent"
41-45_year_percent
Y
"46-50_years_percent"
46-50_year_percent
Y
"51+_years_percent"
51+_year_percent
Y
recruitment_id
recruitment_id
N
registered
registered
N
Y
1040
896
Insert / update (total_registered.age) 3
InsertUpdate
Y
1
none
100
ervu-dashboard
=
recruitment_id
REG_ID
total_registered
"17_years"
17_year_count
Y
"18-26_years"
18-26_year_count
Y
"27-30_years"
27-30_year_count
Y
"31-35_years"
31-35_year_count
Y
"36-40_years"
36-40_year_count
Y
"41-45_years"
41-45_year_count
Y
"51+_years"
41-45_year_count
Y
"all_M_W"
gender
N
"46-50_years"
46-50_year_count
Y
"17_years_percent"
17_year_percent
Y
"18-26_years_percent"
18-26_year_percent
Y
"27-30_years_percent"
27-30_year_percent
Y
"31-35_years_percent"
31-35_year_percent
Y
"36-40_years_percent"
36-40_year_percent
Y
"41-45_years_percent"
41-45_year_percent
Y
"46-50_years_percent"
46-50_year_percent
Y
"51+_years_percent"
51+_year_percent
Y
recruitment_id
recruitment_id
N
registered
registered
N
Y
1072
512
Insert / update (total_registered.age) 3 2
InsertUpdate
Y
1
none
100
ervu-dashboard
=
recruitment_id
REG_ID
total_registered
"17_years"
17_year_count
Y
"18-26_years"
18-26_year_count
Y
"27-30_years"
27-30_year_count
Y
"31-35_years"
31-35_year_count
Y
"36-40_years"
36-40_year_count
Y
"41-45_years"
41-45_year_count
Y
"51+_years"
41-45_year_count
Y
"all_M_W"
gender
N
"46-50_years"
46-50_year_count
Y
"17_years_percent"
17_year_percent
Y
"18-26_years_percent"
18-26_year_percent
Y
"27-30_years_percent"
27-30_year_percent
Y
"31-35_years_percent"
31-35_year_percent
Y
"36-40_years_percent"
36-40_year_percent
Y
"41-45_years_percent"
41-45_year_percent
Y
"46-50_years_percent"
46-50_year_percent
Y
"51+_years_percent"
51+_year_percent
Y
recruitment_id
recruitment_id
N
registered
registered
N
Y
1056
1056
Insert / update (total_registered.age) 4
InsertUpdate
Y
1
none
100
ervu-dashboard
=
recruitment_id
REG_ID
total_registered
"17_years"
17_year_count
Y
"18-26_years"
18-26_year_count
Y
"27-30_years"
27-30_year_count
Y
"31-35_years"
31-35_year_count
Y
"36-40_years"
36-40_year_count
Y
"41-45_years"
41-45_year_count
Y
"51+_years"
41-45_year_count
Y
"all_M_W"
gender
N
"46-50_years"
46-50_year_count
Y
"17_years_percent"
17_year_percent
Y
"18-26_years_percent"
18-26_year_percent
Y
"27-30_years_percent"
27-30_year_percent
Y
"31-35_years_percent"
31-35_year_percent
Y
"36-40_years_percent"
36-40_year_percent
Y
"41-45_years_percent"
41-45_year_percent
Y
"46-50_years_percent"
46-50_year_percent
Y
"51+_years_percent"
51+_year_percent
Y
recruitment_id
recruitment_id
N
registered
registered
N
Y
1040
736
Select values 3 2
SelectValues
Y
1
none
N
REG_ID
REG_ID
String
-2
-2
false
false
VK_ARRAY
VK_ARRAY
String
-2
-2
false
false
816
192
Select values 3 2 2
SelectValues
Y
1
none
N
REG_ID
REG_ID
String
-2
-2
false
false
VK_ARRAY
VK_ARRAY
String
-2
-2
false
false
816
352
Select values 3 2 2 2
SelectValues
Y
1
none
N
REG_ID
REG_ID
String
-2
-2
false
false
VK_ARRAY
VK_ARRAY
String
-2
-2
false
false
816
512
Select values 3 2 2 2 2
SelectValues
Y
1
none
N
REG_ID
REG_ID
String
-2
-2
false
false
VK_ARRAY
VK_ARRAY
String
-2
-2
false
false
800
1056
Select values 3 2 2 3
SelectValues
Y
1
none
N
REG_ID
REG_ID
String
-2
-2
false
false
VK_ARRAY
VK_ARRAY
String
-2
-2
false
false
800
896
Select values 3 2 3
SelectValues
Y
1
none
N
REG_ID
REG_ID
String
-2
-2
false
false
VK_ARRAY
VK_ARRAY
String
-2
-2
false
false
800
736
Table input (person_registry) регион/все
TableInput
Y
1
none
ervu_person_registry
N
0
WITH total_count AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*)
END AS total
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
),
age_counts AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17)
END AS "17_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26)
END AS "18-26_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30)
END AS "27-30_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35)
END AS "31-35_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40)
END AS "36-40_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45)
END AS "41-45_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50)
END AS "46-50_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51)
END AS "51+_year_count"
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "51+_year_percent",
'${REG_ID}' AS recruitment_id,
'ALL' AS gender,
'true' AS registered
FROM age_counts, total_count;
Y
432
192
Table input (person_registry) регион/все 2
TableInput
Y
1
none
ervu_person_registry
N
0
WITH total_count AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*)
END AS total
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'false'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
),
age_counts AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17)
END AS "17_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26)
END AS "18-26_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30)
END AS "27-30_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35)
END AS "31-35_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40)
END AS "36-40_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45)
END AS "41-45_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50)
END AS "46-50_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51)
END AS "51+_year_count"
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'false'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "51+_year_percent",
'${REG_ID}' AS recruitment_id,
'ALL' AS gender,
'false' AS registered
FROM age_counts, total_count;
Y
416
736
Table input (person_registry) регион/женщины
TableInput
Y
1
none
ervu_person_registry
N
0
WITH total_count AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*)
END AS total
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND r.gender = 'FEMALE'
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
),
age_counts AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17)
END AS "17_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26)
END AS "18-26_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30)
END AS "27-30_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35)
END AS "31-35_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40)
END AS "36-40_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45)
END AS "41-45_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50)
END AS "46-50_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51)
END AS "51+_year_count"
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 = 'FEMALE'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "51+_year_percent",
'${REG_ID}' AS recruitment_id,
'W' AS gender,
'true' AS registered
FROM age_counts, total_count;
Y
416
512
Table input (person_registry) регион/женщины 2
TableInput
Y
1
none
ervu_person_registry
N
0
WITH total_count AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*)
END AS total
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'false'
AND r.current_recruitment_id IS NOT NULL
AND r.gender = 'FEMALE'
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
),
age_counts AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17)
END AS "17_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26)
END AS "18-26_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30)
END AS "27-30_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35)
END AS "31-35_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40)
END AS "36-40_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45)
END AS "41-45_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50)
END AS "46-50_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51)
END AS "51+_year_count"
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'false'
AND r.gender = 'FEMALE'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "51+_year_percent",
'${REG_ID}' AS recruitment_id,
'W' AS gender,
'false' AS registered
FROM age_counts, total_count;
Y
400
1056
Table input (person_registry) регион/мужчины
TableInput
Y
1
none
ervu_person_registry
N
0
WITH total_count AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*)
END AS total
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'true'
AND r.current_recruitment_id IS NOT NULL
AND r.gender = 'MALE'
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
),
age_counts AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17)
END AS "17_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26)
END AS "18-26_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30)
END AS "27-30_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35)
END AS "31-35_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40)
END AS "36-40_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45)
END AS "41-45_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50)
END AS "46-50_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51)
END AS "51+_year_count"
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 (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "51+_year_percent",
'${REG_ID}' AS recruitment_id,
'M' AS gender,
'true' AS registered
FROM age_counts, total_count;
Y
432
352
Table input (person_registry) регион/мужчины 2
TableInput
Y
1
none
ervu_person_registry
N
0
WITH total_count AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*)
END AS total
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'false'
AND r.current_recruitment_id IS NOT NULL
AND r.gender = 'MALE'
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
),
age_counts AS (
SELECT
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) = 17)
END AS "17_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 18 AND 26)
END AS "18-26_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 27 AND 30)
END AS "27-30_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 31 AND 35)
END AS "31-35_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 36 AND 40)
END AS "36-40_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 41 AND 45)
END AS "41-45_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) BETWEEN 46 AND 50)
END AS "46-50_year_count",
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = '' THEN 0
ELSE COUNT(*) FILTER (WHERE EXTRACT(YEAR FROM AGE(birth_date)) >= 51)
END AS "51+_year_count"
FROM public.recruits r
JOIN public.recruits_info ri ON ri.recruit_id = r.id
WHERE r.vu_current_info->>'isMilitaryRegistered' = 'false'
AND r.gender = 'MALE'
AND r.current_recruitment_id IS NOT NULL
AND (
'${VK_ARRAY}' IS NULL
OR '${VK_ARRAY}' = ''
OR r.target_recruitment_id = ANY (
string_to_array(
trim(both '{}' FROM replace('${VK_ARRAY}', ' ', '')), ','
)::uuid[]
)
)
)
SELECT
age_counts."17_year_count",
ROUND((age_counts."17_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "17_year_percent",
age_counts."18-26_year_count",
ROUND((age_counts."18-26_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "18-26_year_percent",
age_counts."27-30_year_count",
ROUND((age_counts."27-30_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "27-30_year_percent",
age_counts."31-35_year_count",
ROUND((age_counts."31-35_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "31-35_year_percent",
age_counts."36-40_year_count",
ROUND((age_counts."36-40_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "36-40_year_percent",
age_counts."41-45_year_count",
ROUND((age_counts."41-45_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "41-45_year_percent",
age_counts."46-50_year_count",
ROUND((age_counts."46-50_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "46-50_year_percent",
age_counts."51+_year_count",
ROUND((age_counts."51+_year_count" * 100.0) / NULLIF(total_count.total, 0), 2) AS "51+_year_percent",
'${REG_ID}' AS recruitment_id,
'M' AS gender,
'false' AS registered
FROM age_counts, total_count;
Y
416
896