doctrine / orm

Doctrine Object Relational Mapper (ORM)
https://www.doctrine-project.org/projects/orm.html
MIT License
9.86k stars 2.5k forks source link

Feature Request: PARTITION BY #11446

Open LtMost opened 1 month ago

LtMost commented 1 month ago

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

Being able to use "PARTITION BY" in $this->createQueryBuilder()->select().

it would help to take away the need to build a workaround for a query that is using this:

SELECT 
    customer_id,
    COUNT(*) OVER (PARTITION BY customer_id) AS order_count_per_customer
FROM 
    Orders;
garak commented 1 month ago

I support that, but I think it should be more general and include broader support for window functions. I see that this was already proposed and rejected in #6175 but maybe it should be reconsidered now.

By the way, all the DBMSs supported by doctrine/dbal have now support for window functions, which are not "vendor-specific" (like mentioned in the issue above)