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
exec sp_executesql N'SELECT DISTINCT [l].[PassId]
FROM [Link_Pass_AtlasAffaire] AS [l]
WHERE [l].[StatutAffaire] = 4 AND [l].[ReferenceId] IS NULL AND [l].[PassId] IN (
SELECT [l0].[value]
FROM OPENJSON(@__listPassIds_0) WITH ([value] uniqueidentifier ''$'') AS [l0]
)',N'@__listPassIds_0 nvarchar(4000)',@__listPassIds_0=N'["be8a8784-978d-4a68-9484-08dd095619d2","1579e349-0992-4a3b-6ee1-08dc9c32a29e"]'
query produced
exec sp_executesql N'SELECT DISTINCT [l].[Id], [l].[AtlasId], [l].[PassId], [l].[LastControlDateTime], [l].[LastSendingDateTime], [l].[ReferenceId], [l].[AtlasGroupId], [l].[StatutAffaire]
FROM [Link_Pass_AtlasAffaire] AS [l]
WHERE [l].[StatutAffaire] = 4 AND [l].[ReferenceId] IS NULL AND [l].[PassId] IN (
SELECT [l0].[value]
FROM OPENJSON(@__listPassIds_0) WITH ([value] uniqueidentifier ''$'') AS [l0]
)',N'@__listPassIds_0 nvarchar(4000)',@__listPassIds_0=N'["be8a8784-978d-4a68-9484-08dd095619d2","1579e349-0992-4a3b-6ee1-08dc9c32a29e"]'
my 2 cents
projection is made 'outside' of query scope making distinct work on all columns
I cannot reproduce this: that's why it's always best for users to submit an actual runnable repro, rather than an isolated code snippet as above, which usually isn't enough to reproduce the problem.
I've reconstructed a minimal console program around your query, and it projects only PassId with DISTINCT, as expected. You can try tweaking that code to show what's needed to make it behave incorrectly.
error description
When preparing a query projecting a single id column and using Distinct to avoid duplicate I expect to retrieve... well distinct results
Include your code
expected query
query produced
my 2 cents
projection is made 'outside' of query scope making distinct work on all columns
Include provider and version information
EF Core version:
Database provider: SqlServer 2022 on docker
Target framework: .NET 9
Operating system: Windows 11
IDE: Visual Studio 2022 17.12.3
The text was updated successfully, but these errors were encountered: