The tables have to always be linked as described above to execute instance data queries.
Reading out all steps from an instance including the process data requires the JRINCIDENTS table and the process table to be linked. The corresponding query based on the processid has the following form:
SELECT * FROM JRINCIDENTS i JOIN PROCESSTABLE p ON i.process_step_id = p.step_id
WHERE i.processid = '12345'
If you want to only read out the data of a specific step, you can use the following query using the workflowid.
SELECT * FROM JRINCIDENTS i JOIN PROCESSTABLE p ON i.process_step_id = p.step_id
WHERE i.workflowid = '12345'
Reading out the data of this step from a subtable requires the following query:
SELECT u.* FROM JRINCIDENTS i JOIN SUBTABLE u ON i.process_step_id = p.step_id
WHERE i.workflowid = '12345'
The result will be one result row for every row of the subtable.