Subject Join a table of related records else join other table
Author Venus Software Operations
Hi all

I have a table which can contains a subset records set (selected by
user). If a full report is asked for this table will not contain any
(relevant) data, in that case I need to use the original table to JOIN
to the table used for reporting. Is this possible? Something like

SELECT *
FROM tSaleInvoice TSI
(
JOIN tempSelAccounts TSA
ON TSA.iID = TSI.iBuyerID
AND TSA.JobID = myjobIDparameter
OR
JOIN mAccounts MA
ON MA.iID = TSI.iBuyerID
)

Please advise

Thanks and regards
Bhavbhuti