Skip to content

Query: invalid sql (duplicate order by columns in the list) for query with select anonymous type, order by and group by the same property #12816

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
maumar opened this issue Jul 26, 2018 · 2 comments

Comments

@maumar
Copy link
Contributor

maumar commented Jul 26, 2018

query:

var query = ctx.OrderDetails.Select(od => new { od, customer = od.Order.CustomerID }).OrderBy(e => e.customer).GroupBy(e => e.customer, elementSelector: e => e.od).Select(e => e);
var result = query.ToList();

sql:

SELECT [od].[OrderID], [od].[ProductID], [od].[Discount], [od].[Quantity], [od].[UnitPrice], [od.Order].[CustomerID] AS [customer]
FROM [Order Details] AS [od]
INNER JOIN [Orders] AS [od.Order] ON [od].[OrderID] = [od.Order].[OrderID]
ORDER BY [od.Order].[CustomerID], [customer]
@divega
Copy link
Contributor

divega commented Jun 24, 2019

As per the discussion in triage, removing the proposed-punt label for this. IIRC, we said this is likely going to be fixed for 3.0.

@ajcvickers ajcvickers modified the milestones: 3.0.0, Backlog Jun 28, 2019
@smitpatel smitpatel removed their assignment Aug 7, 2019
@smitpatel
Copy link
Contributor

Duplicate of #17068

@smitpatel smitpatel marked this as a duplicate of #17068 Sep 10, 2019
@smitpatel smitpatel removed this from the Backlog milestone Sep 10, 2019
@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

4 participants