SELECT
*
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Kingdom'
    LIMIT 1
    ) AS "Kingdom"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Subkingdom'
    LIMIT 1
    ) AS "Subkingdom"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Superdivision'
    LIMIT 1
    ) AS "Superdivision"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Division'
    LIMIT 1
    ) AS "Division"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Subdivision'
    LIMIT 1
    ) AS "Subdivision"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Class'
    LIMIT 1
    ) AS "Class"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Subclass'
    LIMIT 1
    ) AS "Subclass"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Order'
    LIMIT 1
    ) AS "Order"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Family'
    LIMIT 1
    ) AS "Family"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Genus'
    LIMIT 1
    ) AS "Genus"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Species'
    LIMIT 1
    ) AS "Species"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Subspecies'
    LIMIT 1
    ) AS "Subspecies"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Variety'
    LIMIT 1
    ) AS "Variety"
, (SELECT plantname.plantname
    FROM plantconcept_ancestors(plantconcept_id)
    JOIN plantconcept USING (plantconcept_id)
    JOIN plantname USING (plantname_id)
    WHERE plantlevel = 'Forma'
    LIMIT 1
    ) AS "Forma"
FROM plantconcept
