Stop projecting last identifier when not needed
Open
area-query
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
LINQ:
```c#
_ = context.Blogs.Select(b => b.Numbers.ToList()).ToList();
```
SQL Server SQL:
```c#
SELECT [b].[Id], CAST([n].[value] AS int) AS [value], [n].[key]
FROM [Blogs] AS [b]
OUTER APPLY OPENJSON([b].[Numbers]) AS [n]
ORDER BY [b].[Id], CAST([n].[key] AS int)
```
We need to order by the key here in order to preserve the collection's ordering; however, there's no reason to project it out to the client. Note the similarity with #19828 - there we removed the last identifier column from the ordering, but not from the projection.
Contributor guide
Assessment
This issue has not been assessed yet.