<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;"><div class=""><div class="">On Jul 2, 2019, at 7:01 PM, Pedro Almeida <<a href="mailto:p.almeida.mc@gmail.com" class="">p.almeida.mc@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div class="">[…]</div><div class=""><br class=""></div><div class="">The best approach for these kind of cases could actually be to select all the terminal nodes from up a certain NCBI taxon id (e.g. 4751 for Fungi). Not sure if this is possible but that might be for another question. :)</div></div></div></div></blockquote><br class="Apple-interchange-newline"></div><div class="">BTW of course this is possible. You can use your original query and change the WHERE clause to “WHERE taxon.ncbi_taxon_id = 4751”. This would be more the typical usage. I.e., for a given NCBI taxon ID, give me all descendants. To limit the result to terminals, you would have to also condition to records for which no child exists (using NOT EXISTS, or, if SQLite doesn’t have that, using an outer join and constraining the outer joined id to NULL).</div><div class=""><br class=""></div><div class=""> -hilmar</div></div><br class=""><div class="">
<div class=""><div style="font-family: Monaco; font-size: 11px; orphans: 2; widows: 2;" class="">-- </div><div style="font-family: Monaco; font-size: 11px; orphans: 2; widows: 2;" class="">Hilmar Lapp -:- <a href="http://lappland.io" class="">lappland.io</a></div></div><div class=""><br class=""></div><br class="Apple-interchange-newline">
</div>
<br class=""></body></html>