Skip to content

Loading…

DDC-1455: Selecting association id (FK) without join #2083

Closed
doctrinebot opened this Issue · 3 comments

2 participants

@doctrinebot

Jira issue originally created by user dimirc:

It might be a missing feature or I might be doing something wrong. I need to select an association (FK) without the need of a join.

I'm trying something like this:

select i.client.id , count(i) as total 
from \Invoice i 
GROUP BY i.client

But I get this error:
Error: Expected Doctrine\ORM\Query\Lexer::T_FROM, got '.'

@doctrinebot

Comment created by @beberlei:

Try

SELECT i.client, count(i) AS total
@doctrinebot

Comment created by @guilhermeblanco:

This is already supported in 2.2-DEV through IDENTITY() DQL function.

SELECT IDENTITY(i.client), count(i) as total 
  FROM \Invoice i 
 GROUP BY i.client
@doctrinebot

Issue was closed with resolution "Invalid"

@doctrinebot doctrinebot added this to the 2.2 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.