Jump to content

Defining Relationships In A Family


mschrank

Recommended Posts

This is difficult. I wish people just kept to nuclear families where we could have simple relationships but it's more complicated now.

I've got the following tables (simplified of course):

name: family
columns: family_id, familyname

name: child
columns: firstname, lastname, child_id, family_id

name: parent
columns: firstname, lastname, parent_id, family_id

name: relationship
columns: parent_id, child_id, relationship

Now I know how to get the kids out that are not in relationship at all: select * from child, relationship where relationship.child_id <> child.child_id

But that's not what I want to do. I basically want to say, "find all the kids that are related to parent_id X" and then say "now show me all the kids that are not in that list"
Link to comment
https://forums.phpfreaks.com/topic/13137-defining-relationships-in-a-family/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.