我有以下表格:
user {user_id, name}
family {child_id, mother_id, father_id, address, household_income}
我想在family
给定中选择一行child_id, mother_id and father_id
并让它返回所有列family
以及与关联的用户名称的 3 个新列child_id, mother_id and father_id
family {child_id, mother_id, father_id, address,
household_income, child_name, mother_name, father_name}
这可能吗?我最初在家庭表中拥有名称和 id,但我觉得在两个表中重复列是多余的。