I have a database table that lists animals in a parent/child relationship. I can display a list of all the species (children) in the cat family (parent), for example. I also figured out how to display a taxon's number of children.

Now I'd like to figure out how to display the number of siblings a taxon has. For example, if there are eight families in the order Carnivora, then the cat family (Felidae) would displayl "7," because it has seven siblings. But if there's just one species in a particular family, then it would display "0" (or no value at all), because it has no siblings.

It seems like it should be simple to do, but I haven't figured it out yet. One complication is that there's an extra taxonomic rank between family and species (genus) that I'm not currently doing much with. An order is a family's parent, and a family is an order's child. But a species is technically a family's GRANDCHILD, and a family is that species' grandparent.

Anyway, thanks for any tips.