Open
Description
openedon Jun 29, 2024
For the following query:
_ = await context.Blogs.Distinct().OrderBy(b => b.Id).ToListAsync()
We currently produce:
SELECT [t].[Id], [t].[Name]
FROM (
SELECT DISTINCT [b].[Id], [b].[Name]
FROM [Blogs] AS [b]
) AS [t]
ORDER BY [t].[Id]
But the pushdown isn't needed, we can generate this instead (note that ORDER BY is processed after DISTINCT in SQL):
SELECT DISTINCT [b].[Id], [b].[Name]
FROM [Blogs] AS [b]
ORDER BY [t].[Id]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment