Order by NULL on grouped selects #5079

Closed
opened 2026-01-22 14:57:49 +01:00 by admin · 2 comments
Owner

Originally created by @whyte624 on GitHub (Apr 1, 2016).

Originally assigned to: @Ocramius on GitHub.

It would be good to be able to add ORDER BY NULL expression on queries that have GROUP BY part.
As it mentioned in Mysql docs:

If a query includes GROUP BY but you want to avoid the overhead of sorting the result, you can suppress sorting by specifying ORDER BY NULL.

Originally created by @whyte624 on GitHub (Apr 1, 2016). Originally assigned to: @Ocramius on GitHub. It would be good to be able to add `ORDER BY NULL` expression on queries that have `GROUP BY` part. As it mentioned in [Mysql docs](http://dev.mysql.com/doc/refman/5.7/en/order-by-optimization.html): > If a query includes GROUP BY but you want to avoid the overhead of sorting the result, you can suppress sorting by specifying ORDER BY NULL.
admin added the New FeatureWon't FixCan't Fix labels 2026-01-22 14:57:49 +01:00
admin closed this issue 2026-01-22 14:57:49 +01:00
Author
Owner

@PezCoder commented on GitHub (Jul 31, 2017):

Can anyone help in how this can be achieved in doctrine ?
I've looked into custom dql functions but that are not helpful as they can be used inside other functions like select, where etc.

We somehow need a way to override the addOrderBy function as it doesn't except 'NULL' OR NULL as parameter. Tried both.

@PezCoder commented on GitHub (Jul 31, 2017): Can anyone help in how this can be achieved in doctrine ? I've looked into custom dql functions but that are not helpful as they can be used inside other functions like select, where etc. We somehow need a way to override the addOrderBy function as it doesn't except 'NULL' OR NULL as parameter. Tried both.
Author
Owner

@Ocramius commented on GitHub (Jul 31, 2017):

This is a micro-optimisation that only makes sense in MySQL. We only provide support for cross-platform available features.

Closing as won't fix.

@Ocramius commented on GitHub (Jul 31, 2017): This is a micro-optimisation that only makes sense in MySQL. We only provide support for cross-platform available features. Closing as `won't fix`.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5079