Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2470

Sql Server error in createQuery using ORDER BY and setMaxResults

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 2.4
    • Fix Version/s: 2.4
    • Component/s: ORM
    • Security Level: All
    • Labels:
    • Environment:
      Windows 7, Apache 2 (xampp 1.8.1), PHP 5.4.7, Symfony 2.2.1

      Description

      Important: This issue only affect to 2.4.* versions

      When executing

      $query = $em->createQuery('
      SELECT m.nombre
           , m.fechainicio
           , m.fechafin 
        FROM Bundle:Medicion m
        JOIN m.estudio e
        JOIN e.cliente c
        JOIN c.usuarios u
       WHERE u.id = :id
       ORDER BY m.fechainicio DESC
      ')
      ->setMaxResults(12);
      

      Get the following error:

      An exception occurred while executing '
      SELECT * 
        FROM (
                 SELECT m0_.NOMBRE AS NOMBRE0
                      , m0_.FECHAINICIO AS FECHAINICIO1
                      , m0_.FECHAFIN AS FECHAFIN2
                      , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum 
                   FROM MEDICION m0_ WITH (NOLOCK) 
                  INNER JOIN ESTUDIO e1_ 
                     ON m0_.ESTUDIO_ID = e1_.ID 
                  INNER JOIN CLIENTE c2_ 
                     ON e1_.CLIENTE_ID = c2_.ID 
                  INNER JOIN USUARIO u3_ 
                     ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
             ) AS doctrine_tbl 
       WHERE doctrine_rownum BETWEEN 1 AND 12
      ' with params [2]:
      
      SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
      

      Attached the BD model

      Added extra info!

      Engine version: Sql server 2008 R2

      When executing this SQL (returned by doctrine error) on Management Studio

      SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
      

      Get the following error:

      El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
      

      But if change "FECHAINICIO1"

      ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
      

      by this

      ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
      

      Don't get error

      regards
      Jonnatan Oyarzún

        Activity

        Jonnatan Oyarzún created issue -
        Guilherme Blanco made changes -
        Field Original Value New Value
        Description When executing

        $query = $em->createQuery(
        'SELECT m.nombre, m.fechainicio, m.fechafin FROM Bundle:Medicion m
        JOIN m.estudio e
        JOIN e.cliente c
        JOIN c.usuarios u
        WHERE u.id = :id
        ORDER BY m.fechainicio DESC')
        ->setMaxResults(12)
        ->setParameter('id', $user->getId());

        Get the following error:

        An exception occurred while executing 'SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12' with params [2]:

        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.

        Attached the BD model

        regards
        Jonnatan Oyarzún
        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        regards
        Jonnatan Oyarzún
        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}


        regards
        Jonnatan Oyarzún
        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        regards
        Jonnatan Oyarzún
        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        for this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        for this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Affects Version/s 2.3.4 [ 10420 ]
        Jonnatan Oyarzún made changes -
        Description When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Important Info

        *This issue only affect to 2.4.* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description Important Info

        *This issue only affect to 2.4.* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        *This issue only affect to 2.4.* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description *This issue only affect to 2.4.* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        *This issue only affect {noformat}to 2.4.*{noformat} versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description *This issue only affect {noformat}to 2.4.*{noformat} versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        *This issue only affect to 2.4.\* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description *This issue only affect to 2.4.\* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        h3 *This issue only affect to 2.4.\* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description h3 *This issue only affect to 2.4.\* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        h3. *This issue only affect to 2.4.\* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description h3. *This issue only affect to 2.4.\* versions*


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        h4. *Important:* This issue only affect to 2.4.\* versions


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Description h4. *Important:* This issue only affect to 2.4.\* versions


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        h4. Important: This issue only affect to 2.4.\* versions


        When executing

        {code}
        $query = $em->createQuery('
        SELECT m.nombre
             , m.fechainicio
             , m.fechafin
          FROM Bundle:Medicion m
          JOIN m.estudio e
          JOIN e.cliente c
          JOIN c.usuarios u
         WHERE u.id = :id
         ORDER BY m.fechainicio DESC
        ')
        ->setMaxResults(12);
        {code}

        Get the following error:

        {code}
        An exception occurred while executing '
        SELECT *
          FROM (
                   SELECT m0_.NOMBRE AS NOMBRE0
                        , m0_.FECHAINICIO AS FECHAINICIO1
                        , m0_.FECHAFIN AS FECHAFIN2
                        , ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum
                     FROM MEDICION m0_ WITH (NOLOCK)
                    INNER JOIN ESTUDIO e1_
                       ON m0_.ESTUDIO_ID = e1_.ID
                    INNER JOIN CLIENTE c2_
                       ON e1_.CLIENTE_ID = c2_.ID
                    INNER JOIN USUARIO u3_
                       ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = ?
               ) AS doctrine_tbl
         WHERE doctrine_rownum BETWEEN 1 AND 12
        ' with params [2]:
        {code}

        {code}
        SQLSTATE[42S22]: [Microsoft][SQL Server Native Client 11.0][SQL Server]El nombre de columna 'FECHAINICIO1' no es válido.
        {code}

        Attached the BD model

        Added extra info!

        Engine version: Sql server 2008 R2

        When executing this SQL (returned by doctrine error) on Management Studio
        {code}
        SELECT * FROM (SELECT m0_.NOMBRE AS NOMBRE0, m0_.FECHAINICIO AS FECHAINICIO1, m0_.FECHAFIN AS FECHAFIN2, ROW_NUMBER() OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM MEDICION m0_ WITH (NOLOCK) INNER JOIN ESTUDIO e1_ ON m0_.ESTUDIO_ID = e1_.ID INNER JOIN CLIENTE c2_ ON e1_.CLIENTE_ID = c2_.ID INNER JOIN USUARIO u3_ ON c2_.ID = u3_.CLIENTE_ID WHERE u3_.ID = 12) AS doctrine_tbl WHERE doctrine_rownum BETWEEN 1 AND 12
        {code}
        Get the following error:
        {code}
        El nombre de columna 'FECHAINICIO1' no es válido. ('FECHAINICIO1' is invalid)
        {code}

        But if change "FECHAINICIO1"
        {code}
        ... OVER (ORDER BY FECHAINICIO1 DESC) AS doctrine_rownum FROM...
        {code}
        by this
        {code}
        ... OVER (ORDER BY m0_.FECHAINICIO DESC) AS doctrine_rownum FROM...
        {code}
        Don't get error


        regards
        Jonnatan Oyarzún
        Jonnatan Oyarzún made changes -
        Component/s ORM [ 10012 ]
        Component/s DQL [ 10014 ]
        Fabio B. Silva made changes -
        Assignee Benjamin Eberlei [ beberlei ] Fabio B. Silva [ fabio.bat.silva ]
        Fabio B. Silva made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.4 [ 10321 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Fabio B. Silva
            Reporter:
            Jonnatan Oyarzún
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: