ttist25
asked on
LEFT JOIN with Multiple lookups to same lookup table
Hello,
I'm working on a query in Microsoft Access SQL view as follows:
The last LEFT JOIN is the one giving me problems. I assume it's because I'm double-dipping into the widgets table for primary and secondary widget types.
What is the best way to handle something like this? I have a third widget type to add as well.
Thanks in advance!
I'm working on a query in Microsoft Access SQL view as follows:
SELECT
People_t.dem_LastName AS [Last Name],
People_t.dem_FirstName AS [First Name],
sup_Sex_t.sup_Sex_Description AS [Sex],
sup_Race_t.sup_Race_Description AS [Race],
sup_Citizenship_t.sup_Citizenship_Description AS [Citizenship Status],
sup_WidgetCategory_t.sup_WidgetCategory_Description AS [Primary Widget Type],
sup_WidgetCategory_t.sup_WidgetCategory_Description AS [Secondary Widget Type],
FROM (((((People_t
LEFT JOIN sup_Sex_t ON People_t.sup_Sex = sup_Sex_t.sup_Sex_ID)
LEFT JOIN sup_Race_t ON People_t.sup_Race = sup_Race_t.sup_Race_ID)
LEFT JOIN sup_Citizenship_t ON People_t.sup_Citizenship = sup_Citizenship_t.sup_Citizenship_ID)
LEFT JOIN sup_WidgetCategory_t ON People_t.ci_PrimaryWidget_ID = sup_WidgetCategory_t.sup_WidgetCategory_ID)
LEFT JOIN sup_WidgetCategory_t ON People_t.ci_SecondaryWidget_ID = sup_WidgetCategory_t.sup_WidgetCategory_ID)
The last LEFT JOIN is the one giving me problems. I assume it's because I'm double-dipping into the widgets table for primary and secondary widget types.
What is the best way to handle something like this? I have a third widget type to add as well.
Thanks in advance!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ooops! I forgot to include the aliases of the selected results
widget1.sup_WidgetCategory _Descripti on AS [Primary Widget Type],
widget2.sup_WidgetCategory _Descripti on AS [Secondary Widget Type]
widget1.sup_WidgetCategory
widget2.sup_WidgetCategory
ASKER
Nice! Thanks!
Open in new window