I would have guessed that you would do the join for each of the unions?
The variant of ANSI SQL your RDBMS supports will impact the approach that you take, but essentially you need to do a nested subquery for your UNION and then JOIN the results the 3rd table. Example stolen from the internet which uses different table/field names but will give you the general idea:
SELECT * FROM
(SELECT Customers.CustomerID, 0 As EmployeeID
SELECT Orders.CustomerID, Orders.EmployeeID
FROM Orders) As E
INNER JOIN Employees ON E.EmployeeID = Employees.EmployeeID
...your WHERE clause will look something like WHERE (E.Company = SSRFACC.SUN_DB AND E.ACCNT_CODE = SSRFACC.ACCNT_CODE)
You might also find it easier simply to use blending "blend" the 3rd table (in a distinct data source) to the first two (in the original data source). This assumes you only need to get at measure values in the 3rd table.