diff flys-backend/doc/schema/postgresql.sql @ 755:a29fd0916803

Added a new view to select qs of a WST. flys-backend/trunk@1988 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 24 May 2011 11:12:59 +0000
parents 5bcf338eadb9
children bf16268629d9
line wrap: on
line diff
--- a/flys-backend/doc/schema/postgresql.sql	Tue May 24 10:49:14 2011 +0000
+++ b/flys-backend/doc/schema/postgresql.sql	Tue May 24 11:12:59 2011 +0000
@@ -228,4 +228,17 @@
         JOIN wsts w         ON wc.wst_id = w.id
     ORDER BY wcv."position", wc."position";
 
+-- view to select the q values of a WST
+CREATE VIEW wst_q_values AS
+    SELECT wc.position AS column_pos,
+           wqr.q       AS q, 
+           r.a         AS a, 
+           r.b         AS b,
+           wc.wst_id   AS wst_id
+    FROM wst_column_q_ranges wcqr
+    JOIN wst_q_ranges wqr ON wcqr.wst_q_range_id = wqr.id
+    JOIN ranges r         ON wqr.range_id        = r.id
+    JOIN wst_columns wc   ON wcqr.wst_column_id  = wc.id
+    ORDER BY wc.position, wcqr.wst_column_id, r.a;
+
 COMMIT;

http://dive4elements.wald.intevation.org