Project

General

Profile

1 373 aaronmk
SELECT '# projects' AS ___;
2 1158 aaronmk
SELECT count(*) AS count
3
FROM project
4 1183 aaronmk
JOIN party ON party_id = datasource_id AND organizationname = :datasource
5 1158 aaronmk
;
6 368 aaronmk
7 374 aaronmk
SELECT 'projects' AS ___;
8 1158 aaronmk
SELECT projectname AS project
9
FROM project
10 1183 aaronmk
JOIN party ON party_id = datasource_id AND organizationname = :datasource
11 1158 aaronmk
ORDER BY project
12
;
13 371 aaronmk
14 616 aaronmk
SELECT E'each project\'s # locations' AS ___;
15
SELECT projectname AS project, count(*) AS locations_count
16 371 aaronmk
FROM project
17 1183 aaronmk
JOIN party ON party_id = datasource_id AND organizationname = :datasource
18 616 aaronmk
JOIN locationevent USING (project_id)
19 371 aaronmk
GROUP BY project
20
ORDER BY project
21
;
22 374 aaronmk
23 616 aaronmk
SELECT '# locations' AS ___;
24 1158 aaronmk
SELECT count(DISTINCT location_id) AS count
25
FROM locationevent
26 1183 aaronmk
JOIN party ON party_id = datasource_id AND organizationname = :datasource
27
WHERE parent_id IS NULL -- no subplots
28 1157 aaronmk
;
29 376 aaronmk
30 1083 aaronmk
SELECT '# location events' AS ___;
31 1158 aaronmk
SELECT count(*) AS count
32
FROM locationevent
33 1183 aaronmk
JOIN party ON party_id = datasource_id AND organizationname = :datasource
34 1158 aaronmk
AND parent_id IS NULL -- no subplots
35 1157 aaronmk
;
36 377 aaronmk
37
SELECT '1st methods' AS ___;
38
SELECT DISTINCT
39
    projectname AS project
40 1156 aaronmk
    , method.name AS method
41 377 aaronmk
FROM project
42 1183 aaronmk
JOIN party ON party_id = datasource_id AND organizationname = :datasource
43 616 aaronmk
JOIN locationevent USING (project_id)
44 1156 aaronmk
JOIN method USING (method_id)
45 377 aaronmk
ORDER BY project, method
46
LIMIT 10;
47
48 1083 aaronmk
SELECT '1st observation measures' AS ___;
49 377 aaronmk
SELECT DISTINCT
50
    projectname AS project
51 1083 aaronmk
    , method.observationmeasure AS observationmeasure
52 377 aaronmk
FROM project
53 1183 aaronmk
JOIN party ON party_id = datasource_id AND organizationname = :datasource
54 616 aaronmk
JOIN locationevent USING (project_id)
55 1083 aaronmk
JOIN method USING (method_id)
56
ORDER BY project, observationmeasure
57 377 aaronmk
LIMIT 10;