L
Lisa
Hi,
I have a question regarding building a query to get a relevant name for a
foreign key.
My database structure is as follows:
Table:ConfigOptions
ID
Name
Location
Table
ependencies
ID
ConfigOptionID
DependencyID
Table:Location
ID
LocationDescription
What I need to do is build a query that returns ConfigOption Name,
ConfigOption Location, Dependency Name, Dependency Location
Using the following query, I can get the real name for ConfigOption Name,
ConfigOption Location, and Dependency Name, but only the FK value for
Dependency Location.
SELECT StaticConfigOptions.parameterName AS Parameter,
StaticConfigOptions.parameterLocation,
(select StaticConfigOptions.parameterName from StaticConfigOptions where
StaticConfigOptions.parameterID = Dependencies.dependency) AS Dependency,
(select StaticConfigOptions.parameterLocation from StaticConfigOptions
WHERE Dependencies.parameterID = StaticConfigOptions.parameterID) AS
DependencyLocationID
FROM StaticConfigOptions INNER JOIN Dependencies ON
StaticConfigOptions.parameterID=Dependencies.parameterID;
How do I get the real name (located in the parameterLocation table under
LocationDescription) to appear?
Whatever I try to do seems to crash Access.
Thank you!!
I have a question regarding building a query to get a relevant name for a
foreign key.
My database structure is as follows:
Table:ConfigOptions
ID
Name
Location
Table
ID
ConfigOptionID
DependencyID
Table:Location
ID
LocationDescription
What I need to do is build a query that returns ConfigOption Name,
ConfigOption Location, Dependency Name, Dependency Location
Using the following query, I can get the real name for ConfigOption Name,
ConfigOption Location, and Dependency Name, but only the FK value for
Dependency Location.
SELECT StaticConfigOptions.parameterName AS Parameter,
StaticConfigOptions.parameterLocation,
(select StaticConfigOptions.parameterName from StaticConfigOptions where
StaticConfigOptions.parameterID = Dependencies.dependency) AS Dependency,
(select StaticConfigOptions.parameterLocation from StaticConfigOptions
WHERE Dependencies.parameterID = StaticConfigOptions.parameterID) AS
DependencyLocationID
FROM StaticConfigOptions INNER JOIN Dependencies ON
StaticConfigOptions.parameterID=Dependencies.parameterID;
How do I get the real name (located in the parameterLocation table under
LocationDescription) to appear?
Whatever I try to do seems to crash Access.
Thank you!!