diff flys-backend/doc/schema/postgresql.sql @ 4651:83a42e6a562d

Added view for selecting ranges in wsts.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 06 Dec 2012 17:30:09 +0100
parents 948c7289fc42
children 20b6ebf23916
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql.sql	Thu Dec 06 13:10:27 2012 +0100
+++ b/flys-backend/doc/schema/postgresql.sql	Thu Dec 06 17:30:09 2012 +0100
@@ -413,4 +413,16 @@
            ON ol.river_id = qmv.river_id
               AND ol.name = qmv.name;
 
+CREATE VIEW wst_ranges
+AS
+  SELECT wc.id             AS wst_column_id,
+         wc.wst_id         AS wst_id,
+         Min(wcv.position) AS a,
+         Max(wcv.position) AS b
+  FROM   wst_columns wc
+         JOIN wst_column_values wcv
+           ON wc.id = wcv.wst_column_id
+  GROUP  BY wc.id,
+            wc.wst_id;
+
 COMMIT;

http://dive4elements.wald.intevation.org