Results 1 to 4 of 4

Thread: Joining Tables

  1. #1
    Join Date
    Oct 2004
    Posts
    9

    Unanswered: Joining Tables

    Relevant Structure:

    MasterOrg (OrgID, OrgName)

    Child1(OrgID, Language)
    Child2(OrgID, Service)
    Child3(OrgID, Population)

    Assuming a data sample as follows:

    MasterOrg:
    Org1, Test Organization
    Org2, Another Agency

    Child1
    Org1, English
    Org1, French
    Org1, Spanish
    Org1, Arabic
    Org2, Spanish
    Org2, Hatian/Creole
    Org3, Hatian/Creole
    Org3, Patios
    Org3, Spanish

    Child2
    Org1, Advocacy
    Org2, Advocacy
    Org2, Counseling
    Org2, Legal Aid
    Org3, Advocacy
    Org3, Counseling
    Org3, Legal Aid

    Child3
    Org1, Seniors
    Org1, Immigrants
    Org2, Women
    Org2, Immigrants
    Org3, Youth

    Is there an SQL statement that can accomplish the following:

    Pull the data into a format that looks something like this:

    Org1, English, Advocacy, Seniors
    Org1, French, , Immigrants
    Org1, Spanish
    Org1, Arabic
    Org2, Spanish, Advocacy, Women
    Org2, Hatian/Creole, Counseling, Immigrants
    Org2, Hatian/Creole, Legal Aid
    Org3, Hatian/Creole, Advocaccy, Youth
    Org3, Patios, Counseling
    Org3, Spanish, legal Aid

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    no

    you have no means of associating the selected child tables in those particular combinations
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Oct 2004
    Posts
    9
    Quote Originally Posted by r937
    no

    you have no means of associating the selected child tables in those particular combinations

    I should have mentioned this to start with. I don't really care which service language and population wind up in one row, as long as they are all from the same Org. Does that change things?

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    no

    still can't do it
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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