How do I convert a relational hierarchy to a closure table in MySQL?
问题 I recently started using a closure table, and it was working fine when I had to convert simple parent-child relationships from person to lineage, but now I have to convert grandparent-parent-child and great-grandparent-parent-child relationships, and maybe even longer relationships than that into the closure table. This is the table I need to pull the relationships from: CREATE TABLE `person` ( `person` BIGINT UNSIGNED NOT NULL , `parent` BIGINT UNSIGNED NULL , PRIMARY KEY (`person`) , INDEX