Andrew
asked on
SQL JOIN help?
Hello,
I am trying to figure out how to query 2 tables to get desired results. The problem I am having is that the same LabName(description) is being returned for all 4 Activity Numbers instead of the corresponding LabName for each Activity Number for each row.
Current query:
[DBLogResInt]
[ActivityCodes]
I am trying to figure out how to query 2 tables to get desired results. The problem I am having is that the same LabName(description) is being returned for all 4 Activity Numbers instead of the corresponding LabName for each Activity Number for each row.
Current query:
SELECT RI.Location, AC.Description AS Lab1, RI.Activity1, (RI.Cost1 * 31) AS Cost1, AC.Description AS Lab2, RI.Activity2, (RI.Cost2 * 31) AS Cost2,
AC.Description AS Lab3, RI.Activity3, (RI.Cost3 * 31) AS Cost3, AC.Description AS Lab4, RI.Activity4, (RI.Cost4 * 31) AS Cost4,
((RI.Cost1 + RI.Cost2 + RI.Cost3 + RI.Cost4) * 31) AS TCost
FROM [SeedTracker].[dbo].[DBLogResInt] AS RI
JOIN [SeedTracker].[dbo].[ActiveCodes] AS AC
ON (RI.Activity1 = AC.ActivityCode)
ORDER BY Location
Results: [DBLogResInt]
[ActivityCodes]
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That did it! Thank you !
ASKER