DDC-2706: [GH-801] Update SqlWalker.php fixed wrong GROUP BY clause on SQL Server platform #3389

Closed
opened 2026-01-22 14:19:05 +01:00 by admin · 3 comments
Owner

Originally created by @doctrinebot on GitHub (Sep 26, 2013).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @doctrinebot:

This issue is created automatically through a Github pull request on behalf of flip111:

Url: https://github.com/doctrine/doctrine2/pull/801

Message:

Without this patch a query would like like:

SELECT c0_.Country AS sclr0
FROM Continent c0_ WITH (NOLOCK)
WHERE c0_.Country = 38
GROUP BY sclr0

Using the column alias in the GROUP BY clause. However this is not allowed on SQL Server. References:

  1. http://stackoverflow.com/a/3841804
  2. http://technet.microsoft.com/en-us/library/ms189499.aspx (Logical Processing Order of the SELECT statement)

The correct query should be:

SELECT c0_.Country AS sclr0
FROM Continent c0_ WITH (NOLOCK)
WHERE c0_.Country = 38
GROUP BY c0_.Country
Originally created by @doctrinebot on GitHub (Sep 26, 2013). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @doctrinebot: This issue is created automatically through a Github pull request on behalf of flip111: Url: https://github.com/doctrine/doctrine2/pull/801 Message: Without this patch a query would like like: ``` SELECT c0_.Country AS sclr0 FROM Continent c0_ WITH (NOLOCK) WHERE c0_.Country = 38 GROUP BY sclr0 ``` Using the column alias in the GROUP BY clause. However this is not allowed on SQL Server. References: 1. http://stackoverflow.com/a/3841804 2. http://technet.microsoft.com/en-us/library/ms189499.aspx (Logical Processing Order of the SELECT statement) The correct query should be: ``` SELECT c0_.Country AS sclr0 FROM Continent c0_ WITH (NOLOCK) WHERE c0_.Country = 38 GROUP BY c0_.Country ```
admin added the Bug label 2026-01-22 14:19:05 +01:00
admin closed this issue 2026-01-22 14:19:05 +01:00
Author
Owner

@doctrinebot commented on GitHub (Oct 1, 2013):

Comment created by @doctrinebot:

A related Github Pull-Request [GH-801] was closed:
https://github.com/doctrine/doctrine2/pull/801

@doctrinebot commented on GitHub (Oct 1, 2013): Comment created by @doctrinebot: A related Github Pull-Request [GH-801] was closed: https://github.com/doctrine/doctrine2/pull/801
Author
Owner

@doctrinebot commented on GitHub (Nov 16, 2013):

Comment created by @FabioBatSilva:

Merged : 2c4c26c5d6

@doctrinebot commented on GitHub (Nov 16, 2013): Comment created by @FabioBatSilva: Merged : https://github.com/doctrine/doctrine2/commit/2c4c26c5d66c4de85b552f3c9a9aedeb66a93351
Author
Owner

@doctrinebot commented on GitHub (Nov 16, 2013):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Nov 16, 2013): Issue was closed with resolution "Fixed"
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#3389