database: Fix instances, where area_commitment.year_from may be NULL

This commit is contained in:
2024-09-18 14:51:14 +02:00
parent d791fba02c
commit a6774b284d
2 changed files with 2 additions and 2 deletions

View File

@ -98,7 +98,7 @@ SELECT s.year, m.mgnr, m.lfbis_nr, m.name,
(COALESCE(m.prefix || ' ', '') || m.given_name || COALESCE(' ' || m.middle_names, '') || COALESCE(' ' || m.suffix, '')) AS other_names,
a.name AS billing_name, COALESCE(a.address, m.address) AS address,
COALESCE(a.country, m.country) AS country, COALESCE(a.postal_dest, m.postal_dest) AS postal_dest,
SUM(IIF(c.year_from <= s.year AND (c.year_to IS NULL OR c.year_to >= s.year), c.area, 0)) AS area
SUM(COALESCE(IIF((c.year_from IS NULL OR c.year_from <= s.year) AND (c.year_to IS NULL OR c.year_to >= s.year), c.area, NULL), 0)) AS area
FROM season s, member m
LEFT JOIN member_billing_address a ON a.mgnr = m.mgnr
LEFT JOIN area_commitment c ON c.mgnr = m.mgnr

View File

@ -1,3 +1,3 @@
-- This value MUST NOT be changed while other connections are open!
PRAGMA schema_version = 2900;
PRAGMA schema_version = 3000;