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

How do I filter by several columns simultaneously without creating a temporary table? #32661

Closed
voroninp opened this issue Dec 22, 2023 · 4 comments

Comments

@voroninp
Copy link

I have a join table

public sealed record DemographicsInPeriod(int DemographicsId, int PeriodId)
{
    public int Id { get; private set; }
}

And I have a collection of pairs (periodId, demographicsId).

Is there a way to filter the result set by both values?

@roji
Copy link
Member

roji commented Dec 22, 2023

That's not currently possible - it may end up being implemented as part of #31237 (though that's more about CLR complex types, and not necessarily about collections of value tuples).

In the meantime you can use dynamic expression generation to integrate your tuple collection as a series if ORs (though that would prevent query caching for variable numbers of collections), or use raw SQL to do something e.g. with OPENJSON.

@voroninp
Copy link
Author

What do you think? Worth creating separate feature request?

@roji
Copy link
Member

roji commented Dec 23, 2023

Duplicate of #11799

@roji roji marked this as a duplicate of #11799 Dec 23, 2023
@roji
Copy link
Member

roji commented Dec 23, 2023

@voroninp I think I found the specific issue - #11799. I've made a note on #31237 to take that into account.

I'll go ahead and close this as a dup of that, but let me know if you think anything is missing etc.

@roji roji closed this as not planned Won't fix, can't repro, duplicate, stale Dec 23, 2023
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

2 participants