mschrank Posted June 28, 2006 Share Posted June 28, 2006 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: familycolumns: family_id, familynamename: childcolumns: firstname, lastname, child_id, family_idname: parentcolumns: firstname, lastname, parent_id, family_idname: relationshipcolumns: parent_id, child_id, relationshipNow 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_idBut 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" Quote Link to comment https://forums.phpfreaks.com/topic/13137-defining-relationships-in-a-family/ Share on other sites More sharing options...
fenway Posted July 3, 2006 Share Posted July 3, 2006 Shouldn't be a problem... simply issue a LEFT JOIN and search for WHERE child_id IS NULL. Quote Link to comment https://forums.phpfreaks.com/topic/13137-defining-relationships-in-a-family/#findComment-52281 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.