Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Query: invalid sql for query with group by with First and OrderBy afterwards #12600

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

Comments

@maumar
Copy link
Contributor

maumar commented Jul 7, 2018

query:

                var query = ctx.Employees.Where(e => e.EmployeeID == 1)
                            .GroupBy(e => e.EmployeeID)
                            .Select(g => EF.Property<string>(g.First(), "Title"))
                            .OrderBy(e => e);

                var result = query.ToList();

sql:

SELECT [e].[Title]
FROM [Employees] AS [e]
WHERE [e].[EmployeeID] = 1
GROUP BY [e].[EmployeeID]
ORDER BY [e].[Title]

error:
Column 'Employees.Title' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.

@divega divega added this to the 2.2.0 milestone Jul 11, 2018
@smitpatel smitpatel removed their assignment Jul 31, 2018
@smitpatel
Copy link
Member

Related #12089

@smitpatel
Copy link
Member

Merged into #13805

@smitpatel smitpatel removed this from the Backlog milestone Sep 25, 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants