This won't work, since the expression is only evaluated once. This evaluation will replace ${runtime:loadResource(...)} with your query, but the expression in the query will not be evaluated. This won't work, since the expression is only evaluated once. once per record. This evaluation will replace ${runtime:loadResource(...)} with your query, but the expression in the loaded query will not be evaluated.
SELECT id FROM ${runtime:loadResource('table', true)} WHERE id = '${record:value(runtime:loadResource('fieldPath', true))}'

Note - if you specify true as the second argument to runtime:loadResource then you must ensure that the resource file is owner read/write only.