reverse the order of CTEs in with clause #2746
Replies: 1 comment 1 reply
-
https://github.com/tobymao/sqlglot/blob/main/posts/ast_primer.md |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is there a way to reverse the order of CTEs in with clause
from sqlglot import select, parse_one, exp, union
a=select("x").with_("tbl", as_=select("x").from_("tb"),copy=False)
b = a.with_("tb2", as_=select("x").from_("tb1") )
print(b)
prints:
WITH tbl AS (SELECT x FROM tb), tb2 AS (SELECT x FROM tb1) SELECT x
I need:
WITH tb2 AS (SELECT x FROM tb1), tbl AS (SELECT x FROM tb) SELECT x
Beta Was this translation helpful? Give feedback.
All reactions