You have two tables:
The T1 table is always present. But the T2 table may be or may not be present at all (no defects - no table). It can happen, for example, if you use the Jira Issues macro to generate tables.
If the T2 table exists, then each defect is linked to the specific issue from the T1 table (see the T2.'Linked Issue' column on the first screenshot).
You need to get the "issue-defect" list with all the additional fields from both tables if there are any defects. If everything is okay, you need to avoid SQL query errors and print the "No Defects" text.
Enter the following SQL query:
IF OBJECT_ID("T2") IS NOT NULL SELECT * FROM T1 JOIN T2 ON T1.'Key'=T2.'Linked Issue' ELSE SELECT FIRST("No Defects") AS 'Defects' FROM T1 |