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

CTEs #130

Open
mathroc opened this issue Mar 6, 2017 · 1 comment
Open

CTEs #130

mathroc opened this issue Mar 6, 2017 · 1 comment

Comments

@mathroc
Copy link

mathroc commented Mar 6, 2017

Hi,

now that mysql will support WITH queries too, is there plan to add support for Common Table Expressions ?

maybe something along those lines :

$select = $query_factory->newSelect();

$cte = $query_factory->newSelect();
$cte->cols('zim')->from('table2');

$select->with('cte1', $cte);

$select->cols(array('foo', 'bar AS barbar'))
       ->from('table1')
       ->from('cte1')
       ->where('cte1.zim = 99');
@pmjones
Copy link
Member

pmjones commented Mar 11, 2017

This is an excellent idea. It may mess up Atlas.Orm, which uses with() to eager-load relationships -- but since Atlas is alpha, it can change to use eager() or something like that instead of the WITH keyword.

@mathroc send along a PR as soon as you can, for the databases that support WITH, and I'll review!

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

No branches or pull requests

2 participants