I'm replacing a subquery with an self join to improve performance of my query.
The old subquery was like this:
The new self join is like this:
but returns a No Current Record error message.
The goal is to find the record that has the same aacode but has the PERSNO number of 2 and return the AgeCat for that record in a column called RAge2,
The old subquery was like this:
Code:
(Select FAge2.AgeCat FROM People AS FAge2 WHERE FAge2.aacode = People.aacode AND FAge2.PERSNO = 2) AS RAge2,
Code:
(SELECT [People].[AgeCat] FROM [People] INNER JOIN [People] AS P2 ON ([People].[aacode] = [P2].[aacode] AND [P2].[PERSNO] = 2)) AS RAge2,
The goal is to find the record that has the same aacode but has the PERSNO number of 2 and return the AgeCat for that record in a column called RAge2,
Comment