Skip to content

Instantly share code, notes, and snippets.

@wykhuh
Created December 15, 2018 00:18
Show Gist options
  • Save wykhuh/a61e7b28cdecd26e22ec1162ddf669e0 to your computer and use it in GitHub Desktop.
Save wykhuh/a61e7b28cdecd26e22ec1162ddf669e0 to your computer and use it in GitHub Desktop.
sql
SELECT
(
SELECT ARRAY_AGG(coalesce(ncbi_nodes.superkingdom, '--') || '|' || coalesce(ncbi_nodes.kingdom, '--'))
FROM ncbi_nodes
WHERE taxon_id in (SELECT ncbi_names.taxon_id from ncbi_names where lower(gbif_ct.class_name) = lower(ncbi_names.name))
) AS ncbi_taxa
FROM combine_taxa as gbif_ct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment