Getting Parent Child hierarchy
问题 I'm trying to get ancestors of a child (dog) upto Level 5. For Example in attached picture I'll be sending "Spencer di Casa Massarelli" and in result want to have associated parents (both father and mother). In my DB structure I've used father_id and mother_id. DB & version: 10.4.11-MariaDB Table Script: CREATE TABLE `dogs` ( `dog_id` int(11) NOT NULL, `name` varchar(255) DEFAULT NULL, `father_id` int(11) DEFAULT NULL, `moter_id` int(11) DEFAULT NULL, PRIMARY KEY (`dog_id`) ) ENGINE=InnoDB