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

WHERE with tuples and IN operator #31492

Closed
rspadim opened this issue Aug 17, 2023 · 2 comments
Closed

WHERE with tuples and IN operator #31492

rspadim opened this issue Aug 17, 2023 · 2 comments

Comments

@rspadim
Copy link

rspadim commented Aug 17, 2023

Hello, I have a table with a primary key using two columns "id1, id2"

I want to search rows that contains, something like a "WHERE (id1,id2) IN ((1,1), (2,2), (3,3))"

At C# i have a list of tupple of int,int, could be possible execute this query using EF?

thanks

@roji
Copy link
Member

roji commented Aug 17, 2023

Duplicate of #26822

@roji roji marked this as a duplicate of #26822 Aug 17, 2023
@roji
Copy link
Member

roji commented Aug 17, 2023

EF currently doesn't support expressing this; #26822 should make that possible. Note that SQL Server doesn't support this at all.

In the meantime, you should be able to rewrite this simply as WHERE (id1 = 1 AND id2 = 1) OR (id1 = 2 AND (id2 = 2) and so forth. The generated SQL is longer/uglier but I'm pretty sure there wouldn't be a performance difference (would be happy to hear about it if otherwise!).

@roji roji changed the title WHERE with tupples and IN operator WHERE with tuples and IN operator Aug 20, 2023
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 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

3 participants