Revision 6093
Added by Aaron Marcuse-Kubitza about 12 years ago
schemas/vegbien.sql | ||
---|---|---|
4227 | 4227 |
-- |
4228 | 4228 |
|
4229 | 4229 |
CREATE VIEW threatened_taxonlabel_view AS |
4230 |
SELECT accepted_taxonlabel_descendant.descendant_id AS taxonlabel_id FROM ((taxonlabel datasource_taxonlabel JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.canon_label_id))) JOIN taxonlabel_relationship accepted_taxonlabel_descendant ON ((accepted_taxonlabel_descendant.ancestor_id = accepted_taxonlabel.taxonlabel_id))) WHERE (((datasource_taxonlabel.reference_id = reference_by_shortname('IUCN'::text)) AND (datasource_taxonlabel.taxonomicname IS NOT NULL)) AND (accepted_taxonlabel.rank >= 'species'::taxonrank)); |
|
4230 |
SELECT DISTINCT accepted_taxonlabel_descendant.descendant_id AS taxonlabel_id FROM ((taxonlabel datasource_taxonlabel JOIN taxonlabel accepted_taxonlabel ON ((accepted_taxonlabel.taxonlabel_id = datasource_taxonlabel.canon_label_id))) JOIN taxonlabel_relationship accepted_taxonlabel_descendant ON ((accepted_taxonlabel_descendant.ancestor_id = accepted_taxonlabel.taxonlabel_id))) WHERE (((datasource_taxonlabel.reference_id = reference_by_shortname('IUCN'::text)) AND (datasource_taxonlabel.taxonomicname IS NOT NULL)) AND (accepted_taxonlabel.rank >= 'species'::taxonrank));
|
|
4231 | 4231 |
|
4232 | 4232 |
|
4233 | 4233 |
-- |
Also available in: Unified diff
schemas/vegbien.sql: threatened_taxonlabel_view: Fixed bug where needed DISTINCT on resulting taxonlabel_id because some descendants apparently appear in multiple threatened taxonlabels' subtrees