See http://allenbrowne.com/ser-06.html Has a pedigree example. I adapted the query to a project.
Help me query to show a family tree?
I have referencing a family data model: People: (id, name, email) Family: (id, head_1_id, head_2_id) Relation: (id, people_id, related_id, relation_type) people_id is fk with People, related_id is fk with People, relation_type: Son, Father, Mother,...
Parent: (parent_id, people_id, parent_id, parent_type)
parent_id fk with People and pk
Why need table Parent, And how to query to show tree as demo: export const treeData = [ { name: 'Niclas Superlongsurname', class: 'man', textClass: 'emphasis', marriages: [ { spouse: { name: 'Iliana', class: 'woman', extra: { nickname: 'Illi', }, }, children: [ { name: 'James', class: 'man', marriages: [ ] } ], },
Sorry for my poor English, please help me, thank you very much
Please or to participate in this conversation.