SELECT x FROM (SELECT y FROM z WHERE (y > 2) UNION ALL SELECT a FROM z WHERE (y < 2)) AS f