WITH cte (col1) AS ( SELECT 1 UNION ALL SELECT 2 ) SELECT * FROM cte INNER JOIN table2 ON table2.col1=cte.col1;