
CREATE VIEW v_plz AS
SELECT plz, o.name AS ort, g.name AS gemeinde, p.name AS bestimmungsort
FROM AT_gemeinde g
    JOIN AT_ort o ON o.gkz = g.gkz
    JOIN AT_plz p ON p.okz = o.okz;

CREATE VIEW v_plz_wg AS
SELECT plz, o.name AS ort, g.name AS gemeinde, p.name AS bestimmungsort
FROM AT_gemeinde g
    JOIN AT_ort o ON o.gkz = g.gkz
    JOIN AT_plz p ON p.okz = o.okz
WHERE (g.gkz / 100) IN (308, 316, 310, 312, 321);
