## Is your feature request related to a problem? A CTE is only accessible from the first query in a union query. ```sql WITH test AS (SELECT 123 AS value) SELECT value FROM test UNION ALL SELECT value FROM test ``` <img width="465" alt="Screenshot 2024-03-01 at 13 50 07" src="https://github.com/PostHog/posthog/assets/1851359/f077d1d6-3c4a-4314-b51f-a687d33f1522"> ## Describe the solution you'd like CTEs should be handled in the same way ClickHouse does. ## Describe alternatives you've considered Repeating the CTE for each query.