| 1 | SELECT
|
|---|
| 2 | distinct ts.taxonomy_species_id,
|
|---|
| 3 | ts.nomen_number,
|
|---|
| 4 | ts.taxonomy_genus_id AS extended_genus_name,
|
|---|
| 5 | ts.species_name,
|
|---|
| 6 | ts.species_authority,
|
|---|
| 7 | ts.is_specific_hybrid,
|
|---|
| 8 | ts.subspecies_name,
|
|---|
| 9 | ts.subspecies_authority,
|
|---|
| 10 | ts.is_subspecific_hybrid,
|
|---|
| 11 | ts.variety_name,
|
|---|
| 12 | ts.variety_authority,
|
|---|
| 13 | ts.is_varietal_hybrid,
|
|---|
| 14 | ts.subvariety_name,
|
|---|
| 15 | ts.subvariety_authority,
|
|---|
| 16 | ts.is_subvarietal_hybrid,
|
|---|
| 17 | ts.forma_rank_type,
|
|---|
| 18 | ts.is_forma_hybrid,
|
|---|
| 19 | ts.forma_name,
|
|---|
| 20 | ts.forma_authority,
|
|---|
| 21 | ts.name_verified_date,
|
|---|
| 22 | ts.verifier_cooperator_id,
|
|---|
| 23 | ts.synonym_code,
|
|---|
| 24 | ts.current_taxonomy_species_id,
|
|---|
| 25 | ts.protologue,
|
|---|
| 26 | ts.protologue_virtual_path,
|
|---|
| 27 | ts.note,
|
|---|
| 28 | ts.hybrid_parentage,
|
|---|
| 29 | ts.name,
|
|---|
| 30 | ts.name_authority,
|
|---|
| 31 | ts.alternate_name,
|
|---|
| 32 | ts.taxonomy_genus_id AS extended_genus_name,
|
|---|
| 33 | (select tg.genus_name from taxonomy_genus tg where tg.taxonomy_genus_id = ts.taxonomy_genus_id) AS genus_name,
|
|---|
| 34 | (select count(*) from accession a2 where a2.taxonomy_species_id = ts.taxonomy_species_id) AS accession_count,
|
|---|
| 35 | ts.priority1_site_id,
|
|---|
| 36 | ts.priority2_site_id,
|
|---|
| 37 | ts.curator1_cooperator_id,
|
|---|
| 38 | ts.curator2_cooperator_id,
|
|---|
| 39 | ts.restriction_code,
|
|---|
| 40 | ts.life_form_code,
|
|---|
| 41 | (select min(name) from taxonomy_common_name tc where ts.taxonomy_species_id = tc.taxonomy_species_id) AS species_common_name,
|
|---|
| 42 | ts.created_date,
|
|---|
| 43 | ts.created_by,
|
|---|
| 44 | ts.modified_date,
|
|---|
| 45 | ts.modified_by,
|
|---|
| 46 | ts.owned_date,
|
|---|
| 47 | ts.owned_by
|
|---|
| 48 | FROM
|
|---|
| 49 | taxonomy_species ts
|
|---|
| 50 | INNER JOIN (
|
|---|
| 51 | SELECT taxonomy_species_id FROM taxonomy_species WHERE taxonomy_species_id IN (:taxonomyspeciesid)
|
|---|
| 52 |
|
|---|
| 53 | UNION SELECT taxonomy_species_id FROM accession WHERE accession_id in (:accessionid)
|
|---|
| 54 |
|
|---|
| 55 | UNION SELECT taxonomy_species_id FROM accession
|
|---|
| 56 | INNER JOIN inventory ON accession.accession_id = inventory.accession_id
|
|---|
| 57 | WHERE inventory_id in (:inventoryid)
|
|---|
| 58 |
|
|---|
| 59 | UNION SELECT taxonomy_species_id FROM taxonomy_species WHERE taxonomy_genus_id in (:taxonomygenusid)
|
|---|
| 60 |
|
|---|
| 61 | UNION SELECT taxonomy_species_id FROM taxonomy_species
|
|---|
| 62 | WHERE curator1_cooperator_id in (:cooperatorid)
|
|---|
| 63 | OR curator2_cooperator_id in (:cooperatorid)
|
|---|
| 64 | OR verifier_cooperator_id in (:cooperatorid)
|
|---|
| 65 |
|
|---|
| 66 | UNION SELECT taxonomy_species_id FROM taxonomy_geography_map WHERE geography_id in (:geographyid)
|
|---|
| 67 |
|
|---|
| 68 | UNION SELECT taxonomy_species_id FROM taxonomy_crop_map WHERE crop_id in (:cropid)
|
|---|
| 69 |
|
|---|
| 70 | ) list ON list.taxonomy_species_id = ts.taxonomy_species_id
|
|---|
| 71 |
|
|---|