SQL 'IN' operator #2688
Replies: 2 comments 3 replies
-
Could you elaborate why https://docs.diesel.rs/1.4.x/diesel/expression_methods/trait.ExpressionMethods.html#method.ne_all does not fit your needs? |
Beta Was this translation helpful? Give feedback.
-
I'm trying to figure out how to write a diesel query using the SQL IN operator, where the operand for IN is not trivially expressible as a finite, list, but rather is fully general as in: https://www.w3schools.com/sql/sql_in.asp Looking through the QueryDsl docs ( https://docs.diesel.rs/diesel/query_dsl/trait.QueryDsl.html ), it's unclear if this exists, or if so which method should be used. In particular, I want to be able to also use the Thanks in advance! |
Beta Was this translation helpful? Give feedback.
-
I came across the problem that I have a list of IDs I want to exclude from a result. So I'd like to build a query with diesel which results in something like this:
SELECT * FROM users WHERE id NOT IN (1,3,9)
and returns all users except those with id 1, 3 or 9.Beta Was this translation helpful? Give feedback.
All reactions