Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2836

DQL errors when attempting to use GROUP BY MAX(field)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Invalid
    • Affects Version/s: 2.3
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:

      Description

      Attempting to run DQL similar to:
      SELECT a FROM ClassName a GROUP BY MAX(a.depth)

      Throws error:
      [Semantical Error] line 0, col 250 near 'MAX(ao.depth)': Error: Cannot group by undefined identification or result variable.

      Per docs, MAX is allowed within GROUP BY: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html#aggregate-functions

      If this error is due to some omission on my part, then perhaps the docs should be extended to show a valid GROUP BY MAX() usage, or the error message expanded for a better hint.

        Activity

        Jon Langevin created issue -
        Marco Pivetta made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Marco Pivetta made changes -
        Project Doctrine Common [ 10043 ] Doctrine 2 - ORM [ 10032 ]
        Key DCOM-185 DDC-2836
        Affects Version/s 2.3 [ 10185 ]
        Affects Version/s 2.3 [ 10183 ]
        Security All [ 10000 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Jon Langevin
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: