diff flys-aft/src/main/resources/sql/flys-common.properties @ 4753:a310aceb2e51

Fetch calculation range (Berechnungsstrecke) for FLYS rivers, too.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 03 Jan 2013 14:19:45 +0100
parents 8ba11e13ae8a
children d9f1202cef78
line wrap: on
line diff
--- a/flys-aft/src/main/resources/sql/flys-common.properties	Thu Jan 03 11:43:16 2013 +0100
+++ b/flys-aft/src/main/resources/sql/flys-common.properties	Thu Jan 03 14:19:45 2013 +0100
@@ -1,4 +1,11 @@
-select.river = SELECT id, name FROM rivers 
+select.rivers = \
+    SELECT r.id AS id, r.name AS name, min(wcv.position) AS min_km, max(wcv.position) AS max_km \
+    FROM rivers r \
+        JOIN wsts w ON r.id = w.river_id \
+        JOIN wst_columns wc ON w.id = wc.wst_id \
+        JOIN wst_column_values wcv ON wcv.wst_column_id = wc.id \
+    WHERE w.kind = 0 \
+    GROUP BY r.id, r.name
 select.gauges = SELECT id, name, official_number FROM gauges WHERE river_id = :river_id
 next.gauge.id = SELECT NEXTVAL('GAUGES_ID_SEQ') AS gauge_id
 insert.gauge = INSERT INTO gauges (id, name, river_id, station, aeo, official_number, datum) \

http://dive4elements.wald.intevation.org