Question
Messy One to Many Joins and Grouping
I manage websites for a large state agency in Texas. I have a
need to redo
queries that list the Local intake numbers for Long term support services
(LTSS), Area Agencies on Aging (AAA), and Mental Retardation Authorities
(MRA) by county for each of the state's 254 counties -- in the past there
was only one intake number per county for each AAA and MRA, with there being
the possibility for multiple LTSS intake numbers. Now there are counties
that have multiple numbers for MRA intake.
Basic Structure of Database Tables:
CountyCenter Table
County (text)
CountyNumber (integer)
AAA_ID (integer)
MRA_ID (integer)
LTSS Table
County (text)
CountyNumber (integer)
City (text) -- optional used when there are multiple offices for a county
IntakeNumber (text)
Region (text)
AAA Table
AAA_ID (integer)
AAAName (text)
AAAPhone (text)
MRA Table
MRA_ID (integer)
MRAName (text)
MRAPhone
MRAOffices
MRA_ID (integer)
IntakePhone (text)
City (Text)
CountyNumber (integer)
My goal is for each county to list in a combined table:
Column 1 = County Name
Column 2 = LTSS Office (Number(s))
Column 3 = MRA Intake Number
Column 4 = AAA Intake Number(s)/City if not main
Do I need a separate table for county that simply has the CountyNumber and
CountyName to use as a control table?
I'd like to do this as efficiently as possible -- thankfully the query won't
be accessed by the general public and will be run only when updated
information is received. Any suggestions as to order of the joins and
groupings in CFOUTPUT? (what I have now creates a lot of duplication)
Thanks in advance for your help,
Michael Brown
Webmaster, Texas Department of Aging and Disability Services
queries that list the Local intake numbers for Long term support services
(LTSS), Area Agencies on Aging (AAA), and Mental Retardation Authorities
(MRA) by county for each of the state's 254 counties -- in the past there
was only one intake number per county for each AAA and MRA, with there being
the possibility for multiple LTSS intake numbers. Now there are counties
that have multiple numbers for MRA intake.
Basic Structure of Database Tables:
CountyCenter Table
County (text)
CountyNumber (integer)
AAA_ID (integer)
MRA_ID (integer)
LTSS Table
County (text)
CountyNumber (integer)
City (text) -- optional used when there are multiple offices for a county
IntakeNumber (text)
Region (text)
AAA Table
AAA_ID (integer)
AAAName (text)
AAAPhone (text)
MRA Table
MRA_ID (integer)
MRAName (text)
MRAPhone
MRAOffices
MRA_ID (integer)
IntakePhone (text)
City (Text)
CountyNumber (integer)
My goal is for each county to list in a combined table:
Column 1 = County Name
Column 2 = LTSS Office (Number(s))
Column 3 = MRA Intake Number
Column 4 = AAA Intake Number(s)/City if not main
Do I need a separate table for county that simply has the CountyNumber and
CountyName to use as a control table?
I'd like to do this as efficiently as possible -- thankfully the query won't
be accessed by the general public and will be run only when updated
information is received. Any suggestions as to order of the joins and
groupings in CFOUTPUT? (what I have now creates a lot of duplication)
Thanks in advance for your help,
Michael Brown
Webmaster, Texas Department of Aging and Disability Services
