using unions with "with" clause

I am trying to do something like the following, but cant figure out how to do this with drizzle syntax.

WITH common_subquery AS (
    SELECT user_id, column1, column2
    FROM shared_table
    WHERE condition
)
SELECT user_id, column1, column2
FROM common_subquery
JOIN table1 ...
UNION
SELECT user_id, column1, column2
FROM common_subquery
JOIN table2 ...
Was this page helpful?