Revision 5972
Added by Aaron Marcuse-Kubitza about 12 years ago
mappings/verify.plots.sql | ||
---|---|---|
1 | 1 |
SELECT '# projects' AS ___; |
2 | 2 |
SELECT count(*) AS count |
3 | 3 |
FROM project |
4 |
WHERE datasource_id =
|
|
5 |
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
|
4 |
WHERE reference_id =
|
|
5 |
(SELECT reference_id FROM reference WHERE shortname = :datasource)
|
|
6 | 6 |
; |
7 | 7 |
|
8 | 8 |
SELECT 'projects' AS ___; |
9 | 9 |
SELECT projectname AS project |
10 | 10 |
FROM project |
11 |
WHERE datasource_id =
|
|
12 |
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
|
11 |
WHERE reference_id =
|
|
12 |
(SELECT reference_id FROM reference WHERE shortname = :datasource)
|
|
13 | 13 |
ORDER BY project |
14 | 14 |
; |
15 | 15 |
|
... | ... | |
17 | 17 |
SELECT projectname AS project, count(*) AS locations_count |
18 | 18 |
FROM project |
19 | 19 |
JOIN locationevent USING (project_id) |
20 |
WHERE project.datasource_id =
|
|
21 |
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
|
20 |
WHERE project.reference_id =
|
|
21 |
(SELECT reference_id FROM reference WHERE shortname = :datasource)
|
|
22 | 22 |
GROUP BY project |
23 | 23 |
ORDER BY project |
24 | 24 |
; |
... | ... | |
26 | 26 |
SELECT '# locations' AS ___; |
27 | 27 |
SELECT count(DISTINCT location_id) AS count |
28 | 28 |
FROM locationevent |
29 |
WHERE datasource_id =
|
|
30 |
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
|
29 |
WHERE reference_id =
|
|
30 |
(SELECT reference_id FROM reference WHERE shortname = :datasource)
|
|
31 | 31 |
AND parent_id IS NULL -- no subplots |
32 | 32 |
; |
33 | 33 |
|
34 | 34 |
SELECT '# location events' AS ___; |
35 | 35 |
SELECT count(*) AS count |
36 | 36 |
FROM locationevent |
37 |
WHERE datasource_id =
|
|
38 |
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
|
37 |
WHERE reference_id =
|
|
38 |
(SELECT reference_id FROM reference WHERE shortname = :datasource)
|
|
39 | 39 |
AND parent_id IS NULL -- no subplots |
40 | 40 |
; |
41 | 41 |
|
... | ... | |
46 | 46 |
FROM project |
47 | 47 |
JOIN locationevent USING (project_id) |
48 | 48 |
JOIN method USING (method_id) |
49 |
WHERE project.datasource_id =
|
|
50 |
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
|
49 |
WHERE project.reference_id =
|
|
50 |
(SELECT reference_id FROM reference WHERE shortname = :datasource)
|
|
51 | 51 |
ORDER BY project, method |
52 | 52 |
LIMIT 10; |
53 | 53 |
|
... | ... | |
58 | 58 |
FROM project |
59 | 59 |
JOIN locationevent USING (project_id) |
60 | 60 |
JOIN method USING (method_id) |
61 |
WHERE project.datasource_id =
|
|
62 |
(SELECT party_id FROM party WHERE organizationname = :datasource)
|
|
61 |
WHERE project.reference_id =
|
|
62 |
(SELECT reference_id FROM reference WHERE shortname = :datasource)
|
|
63 | 63 |
ORDER BY project, observationmeasure |
64 | 64 |
LIMIT 10; |
Also available in: Unified diff
mappings/verify.plots.sql: Updated for current schema