If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Joining Tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-25-04, 20:39
kayk kayk is offline
Registered User
 
Join Date: Oct 2004
Posts: 9
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
Reply With Quote
  #2 (permalink)  
Old 10-25-04, 20:43
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
no

you have no means of associating the selected child tables in those particular combinations
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 10-25-04, 22:42
kayk kayk is offline
Registered User
 
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?
Reply With Quote
  #4 (permalink)  
Old 10-25-04, 22:47
r937 r937 is online now
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
no

still can't do it
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On