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.

  • Watch LEFT JOIN - And
  • give a better example of the data you have and what you want to get in the end - teran
  • Options: JOIN of two tables, WHERE IN or WHERE EXISTS with a subquery. - Akina
  • if the first query returns a single value, then where = maybe - teran
  • @And Thanks, problem solved. - Andrei

0