It is required to obtain information from the first table, and then substitute the obtained information in the WHERE of the second query.
Something like this:
SELECT a FROM b UNION SELECT c FROM d WHERE c = a a at the end is the result from the first query. I hope clearly explained.
LEFT JOIN- Andwhere =maybe - teran