3 CREATE OR REPLACE VIEW siste_aar
6 sted, date_trunc('week', date)
9 WHERE date > now() + interval '1 year ago'
13 CREATE OR REPLACE VIEW siste_halvaar
16 sted, date_trunc('week', date)
19 WHERE date > now() + interval '0.5 year ago'
23 CREATE OR REPLACE VIEW siste_maaned
26 sted, date_trunc('hour', date)
29 WHERE date > now() + interval '1 month ago'
33 CREATE OR REPLACE VIEW siste_uke
36 sted, date_trunc('hour', date)
39 WHERE date > now()+interval '1 week ago'
43 CREATE OR REPLACE VIEW siste_dogn
46 sted, date_trunc('minute', date)
49 WHERE date > now()+interval '1 day ago'
53 /*** De 50.000 punktene med høyest fjernesthjemmefrahet. ***/
55 CREATE OR REPLACE VIEW fjernest
57 ORDER BY avst DESC LIMIT 50000;
59 CREATE OR REPLACE VIEW fjernest_siste_aar
61 WHERE date > now()+interval '1 year ago'
62 ORDER BY avst DESC LIMIT 50000;
64 CREATE OR REPLACE VIEW fjernest_siste_halvaar
66 WHERE date > now()+interval '0.5 year ago'
67 ORDER BY avst DESC LIMIT 50000;
69 CREATE OR REPLACE VIEW fjernest_siste_maaned
71 WHERE date > now() + interval '1 month ago'
72 ORDER BY avst DESC LIMIT 50000;
74 CREATE OR REPLACE VIEW fjernest_siste_uke
76 WHERE date > now() + interval '1 week ago'
77 ORDER BY avst DESC LIMIT 50000;
79 CREATE OR REPLACE VIEW fjernest_siste_dogn
81 WHERE date > now() + interval '1 day ago'
82 ORDER BY avst DESC LIMIT 50000;
86 CREATE OR REPLACE VIEW minutt
89 date_trunc('minute', date)
97 CREATE OR REPLACE VIEW gpx
98 AS SELECT * FROM logg LIMIT 1;
100 -- Lister ut events sammen med loggen.
101 CREATE OR REPLACE VIEW ev AS
103 SELECT 'gps' AS flag, date, koor, sted || ' (' || dist || ')' AS sted, NULL AS descr, avst
106 SELECT 'event' AS flag, date, point(lat,lon), NULL, descr AS descr, NULL
111 CREATE OR REPLACE VIEW wp AS
114 substr(name, 1, 20) AS name,
116 substr(cmt, 1, 20) AS cmt,
120 ORDER BY koor[0] desc, koor[1];