Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WITH clause (Common Table Expressions/CTE) support to SQL Query Builder #5018

Open
0xPaul opened this issue Nov 22, 2021 · 6 comments
Open

Comments

@0xPaul
Copy link

0xPaul commented Nov 22, 2021

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

$queryBuilder->addWith('name', $this->createQueryBuilder()->select(...));

References

@morozov
Copy link
Member

morozov commented Nov 24, 2021

WITH seems to be a special case of a sub-query from the building/syntax standpoint. Linking #2305 for reference.

@ianef
Copy link

ianef commented Oct 30, 2022

SQL Server also supports CTEs:
https://learn.microsoft.com/en-us/sql/t-sql/queries/with-common-table-expression-transact-sql?view=sql-server-ver16

I'd love to see this included. I have a lot DB views and TVFs that use CTEs and it would be a lot simpler to maintain these as queries in my repository classes.
👍

@derrabus
Copy link
Member

derrabus commented Nov 1, 2022

Someone has to build this feature so we can include it. Do you want to give it a try?

@ianef
Copy link

ianef commented Nov 1, 2022 via email

@Cmrickels
Copy link

Has there been any traction on bringing CTEs into query builder ?

@derrabus
Copy link
Member

No. Do you want to work on the feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants