fix pre
This commit is contained in:
parent
7e803368bd
commit
7c7c8b9ee4
1 changed files with 9 additions and 9 deletions
|
|
@ -85,26 +85,26 @@
|
|||
)
|
||||
SELECT
|
||||
COALESCE(r.target_recruitment_id, r.current_recruitment_id) as recruitment_id,
|
||||
ys.year_date AS year,
|
||||
ys.year_date AS year,
|
||||
COALESCE(COUNT(r.id) FILTER (
|
||||
WHERE r.military_registration_date >= ys.year_date
|
||||
AND r.military_registration_date < ys.year_date + INTERVAL '1 year'
|
||||
), 0) AS count_all,
|
||||
COALESCE(COUNT(r.id) FILTER (
|
||||
WHERE r.military_registration_date >= ys.year_date
|
||||
AND r.military_registration_date < ys.year_date + INTERVAL '1 year'
|
||||
AND (r.vu_unset_date IS NULL OR r.vu_unset_date < ys.year_date)
|
||||
), 0) AS count_all,
|
||||
COALESCE(COUNT(r.id) FILTER (
|
||||
WHERE r.military_registration_date >= ys.year_date
|
||||
AND r.military_registration_date < ys.year_date + INTERVAL '1 year'
|
||||
AND DATE_PART('year', AGE(r.system_create_date, r.birth_date)) < 18
|
||||
), 0) AS reaching_17_age,
|
||||
COALESCE(COUNT(r.id) FILTER (
|
||||
COALESCE(COUNT(r.id) FILTER (
|
||||
WHERE r.military_registration_date >= ys.year_date
|
||||
AND r.military_registration_date < ys.year_date + INTERVAL '1 year'
|
||||
AND r.gender = 'FEMALE'
|
||||
), 0) AS women_military_specialty,
|
||||
'Department' as schema
|
||||
FROM year_series ys
|
||||
LEFT JOIN recruits r ON 1=1 -- Соединяем со всеми записями, фильтрация происходит в FILTER
|
||||
LEFT JOIN recruits r ON 1=1
|
||||
GROUP BY ys.year_date, COALESCE(r.target_recruitment_id, r.current_recruitment_id)
|
||||
ORDER BY recruitment_id,year DESC;</sql>
|
||||
ORDER BY recruitment_id, year DESC;</sql>
|
||||
<variables_active>N</variables_active>
|
||||
<attributes/>
|
||||
<GUI>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue