0 votes
1 view
in SQL by (20.3k points)

WITH y AS (

    WITH x AS (

        SELECT * FROM MyTable

    )

    SELECT * FROM x

)

SELECT * FROM y

Does something like this work? I tried it earlier but I couldn't get it to work.

1 Answer

0 votes
by (40.4k points)

Try using common table expressions to reuse previous queries in subsequent ones. You need the form of the statement like this:

WITH x AS 

(

    SELECT * FROM MyTable

), 

y AS 

(

    SELECT * FROM x

)

SELECT * FROM y

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...