You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have tried the Group By translation feature in EF Core 2.1 Preview 2.
The following query generated SELECT N+1, which is expected according to issue #10472.
But the SQL generated is invalid - the syntax near the second MAX call is not valid (I am using SQL Server 13.0).
SELECT [p.Blog].[Name] AS [BlogName], COUNT(*) AS [PostCount], MAX([p].[PublishedDate]) AS [LatestPostDate], MAX((
SELECT COUNT(*)
FROM [Comments] AS [c1]
WHERE [p].[Id] = [c1].[PostId]
) AS [CommentsCount0]) AS [MaxComments]
FROM [Posts] AS [p]
INNER JOIN [Blogs] AS [p.Blog] ON [p].[BlogId] = [p.Blog].[Id]
GROUP BY [p.Blog].[Name]
I am getting the following error:
Exception message: 'MAX' is not a recognized built-in function name.
Stack trace: not important, it's a classic System.Data.SqlClient.SqlException
I have tried the Group By translation feature in EF Core 2.1 Preview 2.
The following query generated SELECT N+1, which is expected according to issue #10472.
My original query was:
I tried to rewrite the query so the post.Comments.Count() was hit before the actual grouping:
But the SQL generated is invalid - the syntax near the second MAX call is not valid (I am using SQL Server 13.0).
I am getting the following error:
Steps to reproduce
Here is the model.
Further technical details
EF Core version: 2.1.0-preview2-final
Database Provider: Microsoft.EntityFrameworkCore.SqlServer
Operating system: Windows 10
IDE: Visual Studio 2017 15.6
The text was updated successfully, but these errors were encountered: