database: Add v_stat_member
This commit is contained in:
@ -39,7 +39,7 @@ ORDER BY year;
|
||||
|
||||
CREATE VIEW v_stat_sort AS
|
||||
SELECT year, sortid,
|
||||
SUM(weight) as sum,
|
||||
SUM(weight) AS sum,
|
||||
ROUND(SUM(kmw * weight) / SUM(weight), 2) AS kmw,
|
||||
ROUND(SUM(oe * weight) / SUM(weight), 1) AS oe,
|
||||
COUNT(DISTINCT did) AS lieferungen,
|
||||
@ -50,7 +50,7 @@ ORDER BY year, sortid;
|
||||
|
||||
CREATE VIEW v_stat_attr AS
|
||||
SELECT year, attrid,
|
||||
SUM(weight) as sum,
|
||||
SUM(weight) AS sum,
|
||||
ROUND(SUM(kmw * weight) / SUM(weight), 2) AS kmw,
|
||||
ROUND(SUM(oe * weight) / SUM(weight), 1) AS oe,
|
||||
COUNT(DISTINCT did) AS lieferungen,
|
||||
@ -61,7 +61,7 @@ ORDER BY year, attrid;
|
||||
|
||||
CREATE VIEW v_stat_sort_attr AS
|
||||
SELECT year, sortid, attrid,
|
||||
SUM(weight) as sum,
|
||||
SUM(weight) AS sum,
|
||||
ROUND(SUM(kmw * weight) / SUM(weight), 2) AS kmw,
|
||||
ROUND(SUM(oe * weight) / SUM(weight), 1) AS oe,
|
||||
COUNT(DISTINCT did) AS lieferungen,
|
||||
@ -70,6 +70,16 @@ FROM v_delivery
|
||||
GROUP BY year, sortid, attrid
|
||||
ORDER BY year, sortid, attrid;
|
||||
|
||||
CREATE VIEW v_stat_member AS
|
||||
SELECT year, mgnr,
|
||||
SUM(weight) AS sum,
|
||||
ROUND(SUM(kmw * weight) / SUM(weight), 2) AS kmw,
|
||||
ROUND(SUM(oe * weight) / SUM(weight), 1) AS oe,
|
||||
COUNT(DISTINCT did) AS lieferungen
|
||||
FROM v_delivery
|
||||
GROUP BY year, mgnr
|
||||
ORDER BY year, mgnr;
|
||||
|
||||
CREATE VIEW v_bki_member AS
|
||||
SELECT s.year, m.mgnr, m.lfbis_nr, m.family_name,
|
||||
(COALESCE(m.prefix || ' ', '') || m.given_name || COALESCE(' ' || m.middle_names, '') || COALESCE(' ' || m.suffix, '')) AS name,
|
||||
|
@ -1,3 +1,3 @@
|
||||
|
||||
-- This value MUST NOT be changed while other connections are open!
|
||||
PRAGMA schema_version = 1100;
|
||||
PRAGMA schema_version = 1200;
|
||||
|
Reference in New Issue
Block a user