Project

General

Profile

1
SELECT '# projects' AS ___;
2
SELECT count(*) AS count
3
FROM project
4
JOIN party ON party_id = datasource_id AND organizationname = :datasource
5
;
6

    
7
SELECT 'projects' AS ___;
8
SELECT projectname AS project
9
FROM project
10
JOIN party ON party_id = datasource_id AND organizationname = :datasource
11
ORDER BY project
12
;
13

    
14
SELECT E'each project\'s # locations' AS ___;
15
SELECT projectname AS project, count(*) AS locations_count
16
FROM project
17
JOIN party ON party_id = datasource_id AND organizationname = :datasource
18
JOIN locationevent USING (project_id)
19
GROUP BY project
20
ORDER BY project
21
;
22

    
23
SELECT '# locations' AS ___;
24
SELECT count(DISTINCT location_id) AS count
25
FROM locationevent
26
JOIN party ON party_id = datasource_id AND organizationname = :datasource
27
WHERE parent_id IS NULL -- no subplots
28
;
29

    
30
SELECT '# location events' AS ___;
31
SELECT count(*) AS count
32
FROM locationevent
33
JOIN party ON party_id = datasource_id AND organizationname = :datasource
34
AND parent_id IS NULL -- no subplots
35
;
36

    
37
SELECT '1st methods' AS ___;
38
SELECT DISTINCT
39
    projectname AS project
40
    , method.name AS method
41
FROM project
42
JOIN party ON party_id = datasource_id AND organizationname = :datasource
43
JOIN locationevent USING (project_id)
44
JOIN method USING (method_id)
45
ORDER BY project, method
46
LIMIT 10;
47

    
48
SELECT '1st observation measures' AS ___;
49
SELECT DISTINCT
50
    projectname AS project
51
    , method.observationmeasure AS observationmeasure
52
FROM project
53
JOIN party ON party_id = datasource_id AND organizationname = :datasource
54
JOIN locationevent USING (project_id)
55
JOIN method USING (method_id)
56
ORDER BY project, observationmeasure
57
LIMIT 10;
(15-15/15)