Project

General

Profile

« Previous | Next » 

Revision 1158

VegBIEN verifications: Select only the records for the datasource being verified

View differences:

inputs/SALVIAS/verify.sql
1 1
SELECT '# projects' AS ___;
2
SELECT count(*) AS count FROM project;
2
SELECT count(*) AS count
3
FROM project
4
JOIN party ON party_id = datasource_id
5
WHERE organizationname = 'SALVIAS'
6
;
3 7

  
4 8
SELECT 'projects' AS ___;
5
SELECT projectname AS project FROM project ORDER BY project;
9
SELECT projectname AS project
10
FROM project
11
JOIN party ON party_id = datasource_id
12
WHERE organizationname = 'SALVIAS'
13
ORDER BY project
14
;
6 15

  
7 16
SELECT E'each project\'s # locations' AS ___;
8 17
SELECT projectname AS project, count(*) AS locations_count
9 18
FROM project
19
JOIN party ON party_id = datasource_id
10 20
JOIN locationevent USING (project_id)
21
WHERE organizationname = 'SALVIAS'
11 22
GROUP BY project
12 23
ORDER BY project
13 24
;
14 25

  
15 26
SELECT '# locations' AS ___;
16
SELECT count(*) AS count FROM location
17
WHERE parent_id IS NULL -- no subplots
27
SELECT count(DISTINCT location_id) AS count
28
FROM locationevent
29
JOIN party ON party_id = datasource_id
30
WHERE organizationname = 'SALVIAS'
31
AND parent_id IS NULL -- no subplots
18 32
;
19 33

  
20 34
SELECT '# location events' AS ___;
21
SELECT count(*) AS count FROM locationevent
22
WHERE parent_id IS NULL -- no subplots
35
SELECT count(*) AS count
36
FROM locationevent
37
JOIN party ON party_id = datasource_id
38
WHERE organizationname = 'SALVIAS'
39
AND parent_id IS NULL -- no subplots
23 40
;
24 41

  
25 42
SELECT '1st methods' AS ___;
......
27 44
    projectname AS project
28 45
    , method.name AS method
29 46
FROM project
47
JOIN party ON party_id = datasource_id
30 48
JOIN locationevent USING (project_id)
31 49
JOIN method USING (method_id)
50
WHERE organizationname = 'SALVIAS'
32 51
ORDER BY project, method
33 52
LIMIT 10;
34 53

  
......
37 56
    projectname AS project
38 57
    , method.observationmeasure AS observationmeasure
39 58
FROM project
59
JOIN party ON party_id = datasource_id
40 60
JOIN locationevent USING (project_id)
41 61
JOIN method USING (method_id)
62
WHERE organizationname = 'SALVIAS'
42 63
ORDER BY project, observationmeasure
43 64
LIMIT 10;

Also available in: Unified diff