The UNION keyword is used to combine the result-set of two or more SELECT statements. For example:

SELECT tickets.id FROM (
  (SELECT tickets.id FROM tickets)
  UNION
  (SELECT tickets.id FROM tickets)
) as t1

UNION needs to be embedded inside FROM (technically making it a sub-query).

Published: 23/03/2018

Last updated: 22/05/2018