+ Reply to Thread
Results 1 to 2 of 2

Thread: SQL Left Outer Join Problem

  1. #1
    Barn Newbie ubundom is an unknown quantity at this point ubundom's Avatar
    Join Date
    Oct 2008
    Posts
    3
    Rep Power
    4

    SQL Left Outer Join Problem

    I want to create a table of siblings from the following table:


    Child, Surname, Address, Firstname
    1, Adamson, 1 The Beeches, Joe
    2, Adamson, 1 The Beeches, Mike
    3, Bagshott, 2 The Beeches, Phil
    4, Bagshott, 15 The Beeches, April
    5, Adamson, 8A Acacia Avenue, Phil
    6, Meldrew, The Manor House, Alfred
    7, Adamson, 8A Acacia Avenue, Peter
    8, Meldrew, The Manor House, Quentin
    9, Adamson, 1 The Beeches, Susan


    This is the desired result:


    Family, Surname, Address, Siblings
    1, Adamson, 1 The Beeches, Joe, Mike & Susan
    2, Bagshott, 2 The Beeches, Phil
    3, Bagshott, 15 The Beeches, April
    4, Adamson, 8A Acacia Avenue, Phil & Peter
    5, Meldrew, The Manor House, Alfred & Quentin


    So far I have worked out that I need to create a table of unique Family addresses, but cannot get my head around how to do the rest ... Any help would be much appreciated.
    Last edited by ubundom; October 24th, 2008 at 11:05 AM.

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    This seems to be more of a database design question, so I will move this thread to that forum.

    So it looks like you want to relate families to children to addresses...so something like this:

    Families
    FamilyID Surname

    Siblings
    SiblingID FirstName

    Addresses
    AddressID Address

    Families_Addresses_Link
    FamilyID AddressID

    Families_Siblings_Link
    FamilyID SiblingID

    Does that make sense?
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread

Similar Threads

  1. sql inner outer join help
    By peebman2000 in forum SQL Development
    Replies: 6
    Last Post: September 22nd, 2008, 12:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO