SUPPORT-8925 fix child

This commit is contained in:
y.kuznetsova 2025-03-04 12:07:50 +03:00
parent fd33d501e1
commit 7d9e2f876c

View file

@ -264,10 +264,7 @@
COALESCE(SUM("2_child"), 0) two_children,
COALESCE(SUM("3_child"), 0) three_children,
COALESCE(SUM("4_more_child"), 0) four_or_more_children,
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = ''
THEN 0
ELSE COALESCE(
COALESCE(
CASE
WHEN SUM(total_count) > 0
THEN ROUND((SUM(no_child) / SUM(total_count) * 100), 2)
@ -275,10 +272,7 @@
END,
0
) no_children_percent,
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = ''
THEN 0
ELSE COALESCE(
COALESCE(
CASE
WHEN SUM(total_count) > 0
THEN ROUND((SUM("1_child") / SUM(total_count) * 100), 2)
@ -286,10 +280,7 @@
END,
0
) one_child_percent,
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = ''
THEN 0
ELSE COALESCE(
COALESCE(
CASE
WHEN SUM(total_count) > 0
THEN ROUND((SUM("2_child") / SUM(total_count) * 100), 2)
@ -297,10 +288,7 @@
END,
0
) two_children_percent,
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = ''
THEN 0
ELSE COALESCE(
COALESCE(
CASE
WHEN SUM(total_count) > 0
THEN ROUND((SUM("3_child") / SUM(total_count) * 100), 2)
@ -308,10 +296,7 @@
END,
0
) three_children_percent,
CASE
WHEN '${VK_ARRAY}' IS NULL OR '${VK_ARRAY}' = ''
THEN 0
ELSE COALESCE(
COALESCE(
CASE
WHEN SUM(total_count) > 0
THEN ROUND((SUM("4_more_child") / SUM(total_count) * 100), 2)
@ -321,7 +306,7 @@
) four_or_more_children_percent,
'${REG_ID}' AS recruitment_id,
"all_M_W" AS gender,
convicts,
convicts,
'Organization' AS schema
FROM total_registered.child_minor
WHERE recruitment_id = ANY ('${VK_ARRAY}')