-
Notifications
You must be signed in to change notification settings - Fork 221
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
Multiple Filters #1451
Comments
To use AND or OR expression, you should do like this. .filter(
col("name")
.not_like(text("D%"))
.and(col("name").not_like(text("M___"))),
) https://github.com/gluesql/gluesql/blob/main/test-suite/src/ast_builder/expr/pattern_matching.rs#L69 .filter("c.name = 'Fruit' OR c.name = 'Meat'") https://github.com/gluesql/gluesql/blob/main/test-suite/src/ast_builder/select.rs#L85 |
adding filter multiple times should work like below, gluesql/core/src/ast_builder/select/filter.rs Lines 142 to 150 in 235fd6e
|
Sure, this worked fine for select(). for update() I tried the other day and was not working. |
thanks, yes it was only working for select(). ref. |
Hi,
I was wondering if there is any plan or a current workaround for using multiple filters (esp on select and update)
Originally I had a misunderstanding on AST builder syntax and I thought adding .filter() multiple times will keep adding nested filter, but turns out every new filter was just overriding another filter.
Then I tried adding AND within one filter expression, but I do not see the effect of the nested filter. From what I tested, it seems like only the first condition in the filter gets recognized, and the rest is discarded.
I saw online that we might be able to use subqueries (queries on top of queries) to get it solved. I am wondering if there is anything similar to such a concept in gluesql that I can use as a workaround.
Example of AND/OR within WHERE
https://www.techonthenet.com/sql/where.php
The text was updated successfully, but these errors were encountered: