Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-3238

GROUP BY does not work as expected in MS SQL Server

    Details

    • Type: Bug
    • Status: Awaiting Feedback
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4.1, 2.4.2
    • Fix Version/s: None
    • Component/s: None
    • Security Level: All
    • Labels:
      None
    • Environment:
      MS SQL Server 2012

      Description

      Running the query taken from this page: <http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html>

      $query = $em->createQuery('SELECT u, count(g.id) FROM FundAsset u JOIN u.locations g GROUP BY u.id');
      

      I receive the following error from MS SQL Server:

      SQLSTATE[42000]: [Microsoft][SQL Server Native Client 11.0][SQL Server]Column 'fund_assets.active' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
      

      It appears that Doctrine's GROUP BY clause does not work correctly in Microsoft SQL Server.

        Activity

        Hide
        ocramius Marco Pivetta added a comment -

        Needs a failing test case.

        Show
        ocramius Marco Pivetta added a comment - Needs a failing test case.

          People

          • Assignee:
            beberlei Benjamin Eberlei
            Reporter:
            spencerweiss Spencer Weiss
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: