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 produced for query with non-trivial group aggregate and coalesce #12658

Closed
maumar opened this issue Jul 13, 2018 · 1 comment

Comments

@maumar
Copy link
Contributor

maumar commented Jul 13, 2018

query:

                var query = ctx.LevelOne.GroupBy(
                    l1 => l1.OneToOne_Required_PK.OneToOne_Required_PK.Name,
                    l1 => new
                    {
                        Id = ((int?)l1.OneToOne_Required_PK.Id ?? 0)
                    })
                .Where(g => g.Min(l1 => l1.Id + l1.Id) > 0)
                .Select(g => g.Count());

                var result = query.ToList();

sql:

SELECT COUNT(*)
FROM [Level1] AS [l1]
GROUP BY [l1].[Level3_Name]
HAVING MIN(COALESCE([l1].[Id], 0) AS [Id] + COALESCE([l1].[Id], 0) AS [Id]) > 0, 

exception:
Incorrect syntax near '+'.

@divega divega added this to the 2.2.0 milestone Jul 16, 2018
@maumar maumar changed the title Query: invalid SQL produced for query Query: invalid SQL produced for query with non-trivial group aggregate and coalesce Jul 18, 2018
@smitpatel
Copy link
Member

Duplicate of #12826

@smitpatel smitpatel marked this as a duplicate of #12826 Jul 27, 2018
@smitpatel smitpatel removed this from the 2.2.0 milestone Jul 27, 2018
@smitpatel smitpatel removed their assignment Jul 27, 2018
@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