I have a database table that lists animals in a parent-child relationship, like this:
TAXON | PARENT
Mammalia | Vertebrata
Carnivora | Mammalia
Canidae | Carnivora
Canis | Canidae
Canis_lupus | Canis
The query below displays a particular taxon’s children. For example, on a family page (e.g. Canidae), it will display that family’s genera (e.g. Canis). And if I display it on the genus page (Canis), it displays that genus’ children, or species (e.g. Canis_lupus).
$Children = mysql_query ("SELECT L.N, L.Taxon, L.Parent, L.Rank
FROM gz_life AS L
WHERE L.Parent = '$MyURL'");
I’d like to know if there’s a way to skip a generation, so that displaying the query on a family page would display that family’s GRAND CHILDREN, or species.
TAXON | PARENT
Mammalia | Vertebrata
Carnivora | Mammalia
Canidae | Carnivora
Canis | Canidae (Skip the children)
Canis_lupus | Canis (Display the grand children instead.)
I figured out how to do the opposite - display grandparents and great grandparents. But I don’t know how to do the opposite.
Thanks.