-
Selecting/Joining from Same Table/Column Twice
I have a table (tblUnitsOfMeasure) that has a column (UnitName) which
has two foriegn key relationships contained in another table.(tblDD1532) columns(Application_Unit)(Area_Unit)
When the data is returned, it does not recognize the unique value for the second column(Area_Unit)
For example:
Application_Unit has a UnitName of Gallon
Area_Unit UnitName of Ounce.
However, both get returned back as Gallon.
This is my join before assigning correlation names.
Inner Join tblUnitsOfMeasure On
tblDD1532.Application_UnitsOfMeasure_ID=tblUnitsof Measure.UnitsOfMeasure
Inner Join tblUnitsOfMeasure ON
tblDD1532.Area_Units=tblUnitsOfMeasure.UnitsOfMeas ure_ID
I have tried assigning correlation names, but I am screwing something up.
Made no difference.
Any suggestions would be appreciated.
Thanks
-
You have to join tblUnitsOfMeasure table using alias
select t1.unitname, t2.unitname
Inner Join tblUnitsOfMeasure as t1 On
tblDD1532.Application_UnitsOfMeasure_ID=t1.UnitsOf Measure
Inner Join tblUnitsOfMeasure as t2 ON
tblDD1532.Area_Units=t2.UnitsOfMeas ure_ID
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|