I have been trying to replace some working code which currently uses multiple table relationships to produce separate results eventually coming together into a single end-result table.
The code that I would like to replace it with would be a single 'nested query'.
The code I attempted to use is as follows:
I know that the 'internal' query works since I executed it independently before putting it inside the 'nest'. And I know that the fields all exist in the appropriate tables since they are all used and referenced in the above mentioned working code.
But when I execute the above code I get an error message
SQL: Subquery is invalid
Your insight and advice would be most welcome.
Thanks,
JRB-Bldr
The code that I would like to replace it with would be a single 'nested query'.
The code I attempted to use is as follows:
Code:
SELECT LoadHist.List_ID,;
LoadHist.Load_Date AS LastLoad;
FROM LoadHist;
WHERE LoadHist.Agent_Code IN ;
(SELECT AgtMaster.Agent_Code,;
AgtOrder.Quota;
From AgtMaster, AgtOrder;
Where AgtOrder.Agent_Code = AgtMaster.Agent_Code;
AND EMPTY(AgtOrder.End_Date);
AND AgtOrder.Appl = "ABCD")
I know that the 'internal' query works since I executed it independently before putting it inside the 'nest'. And I know that the fields all exist in the appropriate tables since they are all used and referenced in the above mentioned working code.
But when I execute the above code I get an error message
SQL: Subquery is invalid
Your insight and advice would be most welcome.
Thanks,
JRB-Bldr