The basic idea: I want a list of all of the processes that exist within a certain division. Processes are related to OperationalUnits, which are related to Divisions.
The query I want:
SELECT ID, ProcessName FROM Processes WHERE Unit IN (SELECT ID FROM OperationalUnits WHERE Division='1');
This always throws me a "type mismatch in expression" error.
I've tested by breaking the query down into the two component queries:
SELECT ID FROM OperationalUnits WHERE Division='1';
This returns a single ID, 2, which is what I expect from my test data.
SELECT ID, ProcessName FROM Processes WHERE Unit IN ('2');
This returns a single process, which is again exactly what I expect.
But if I combine them back together into the main query? Nope. It appears that the issue is that the inside query returns [2], while the outside query only works if it returns ['2'], but that doesn't seem like it can be right to me. Any help is appreciated!