AreaCom: Make YearFrom nullable
All checks were successful
Test / Run tests (push) Successful in 1m48s

This commit is contained in:
2024-09-18 14:38:53 +02:00
parent d8beb03b96
commit 21a1b11d68
8 changed files with 25 additions and 7 deletions

View File

@ -0,0 +1,18 @@
-- schema version 29 to 30
PRAGMA writable_schema = ON;
DROP VIEW v_bki_member;
CREATE VIEW v_bki_member AS
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(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
GROUP BY s.year, m.mgnr;
PRAGMA schema_version = 2901;
PRAGMA writable_schema = OFF;