DDC-1000: HAVING clause does not support scalar values #1244

Closed
opened 2026-01-22 13:07:04 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Jan 23, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user felicitus:

The following DQL doesn't work:

SELECT (o.balance * o.multiplier) AS result, o FROM test\Object o HAVING result > 10

Doctrine2 tells me: Error: 'result' does not point to a Class. Unfortunately the documentation doesn't tell the developer how to get around this; maybe it is already possible, maybe it's not.

Originally created by @doctrinebot on GitHub (Jan 23, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user felicitus: The following DQL doesn't work: ``` SELECT (o.balance * o.multiplier) AS result, o FROM test\Object o HAVING result > 10 ``` Doctrine2 tells me: Error: 'result' does not point to a Class. Unfortunately the documentation doesn't tell the developer how to get around this; maybe it is already possible, maybe it's not.
admin added the Bug label 2026-01-22 13:07:04 +01:00
admin closed this issue 2026-01-22 13:07:05 +01:00
Author
Owner

@doctrinebot commented on GitHub (Jan 24, 2011):

Comment created by @beberlei:

Not a bug, if you read the EBNF this is not supported. Some database vendors don't support this becaues SELECT is evaluated after HAVING. DQL is vendor abstration, so this will never be supported.

@doctrinebot commented on GitHub (Jan 24, 2011): Comment created by @beberlei: Not a bug, if you read the EBNF this is not supported. Some database vendors don't support this becaues SELECT is evaluated after HAVING. DQL is vendor abstration, so this will never be supported.
Author
Owner

@doctrinebot commented on GitHub (Jan 24, 2011):

Issue was closed with resolution "Invalid"

@doctrinebot commented on GitHub (Jan 24, 2011): Issue was closed with resolution "Invalid"
Author
Owner

@doctrinebot commented on GitHub (Jan 24, 2011):

Comment created by felicitus:

What's the workaround then? Subselects or something similar, or filtering in PHP code?

@doctrinebot commented on GitHub (Jan 24, 2011): Comment created by felicitus: What's the workaround then? Subselects or something similar, or filtering in PHP code?
Author
Owner

@doctrinebot commented on GitHub (Jan 24, 2011):

Comment created by @beberlei:

The workaround is:

SELECT (o.balance ** o.multiplier) AS result, o FROM test\Object o HAVING (o.balance ** o.multiplier) > 10

Or use Native SQL.

@doctrinebot commented on GitHub (Jan 24, 2011): Comment created by @beberlei: The workaround is: ``` SELECT (o.balance ** o.multiplier) AS result, o FROM test\Object o HAVING (o.balance ** o.multiplier) > 10 ``` Or use Native SQL.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1244