Wednesday, March 21, 2012

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 Aidno

you have no means of associating the selected child tables in those particular combinations|||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?|||no

still can't do it

No comments:

Post a Comment