Project

General

Profile

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

    
7
SELECT '# families' AS ___;
8
SELECT count(DISTINCT plantname) AS count
9
FROM specimenreplicate
10
JOIN party ON party_id = datasource_id AND organizationname = :datasource
11
JOIN taxondetermination USING (taxonoccurrence_id)
12
JOIN plantconcept USING (plantconcept_id)
13
JOIN plantname
14
    ON plantname.plantname_id = plantconcept.plantname_id
15
    AND plantname.rank = 'Family'
16
WHERE taxondetermination.isoriginal
17
;
18

    
19
SELECT '# genera' AS ___;
20
SELECT count(DISTINCT plantname) AS count
21
FROM specimenreplicate
22
JOIN party ON party_id = datasource_id AND organizationname = :datasource
23
JOIN taxondetermination USING (taxonoccurrence_id)
24
JOIN plantconcept USING (plantconcept_id)
25
JOIN plantname
26
    ON plantname.plantname_id = plantconcept.plantname_id
27
    AND plantname.rank = 'Genus'
28
WHERE taxondetermination.isoriginal
29
;
30

    
31
SELECT '# species' AS ___;
32
SELECT count(DISTINCT genus.plantname || ',' || species.plantname) AS count
33
FROM specimenreplicate
34
JOIN party ON party_id = datasource_id AND organizationname = :datasource
35
JOIN taxondetermination USING (taxonoccurrence_id)
36
JOIN plantconcept USING (plantconcept_id)
37
JOIN plantname AS genus
38
    ON genus.plantname_id = plantconcept.plantname_id
39
    AND genus.rank = 'Genus'
40
JOIN plantname AS species
41
    ON species.plantname_id = plantconcept.plantname_id
42
    AND species.rank = 'Species'
43
WHERE taxondetermination.isoriginal
44
;
(14-14/14)