Multiple conditions issue
See original GitHub issueI`m trying to make a query something like this: SELECT * FROM ‘PersonnelTable’ WHERE country LIKE ‘%UAE%’ AND region LIKE ‘%Abu-dabi%’ AND (lastName LIKE ‘%ha%’ OR firstName LIKE ‘%ha%’)
Here is how I`m trying:
ConditionGroup conditionGroup = ConditionGroup.clause();
conditionGroup.and(Condition.column(new NameAlias("country")).like("%"+ countryName +"%"));
conditionGroup.and(Condition.column(new NameAlias("region")).like("%"+ regionName +"%"));
conditionGroup.and(Condition.column(new NameAlias("firstName")).like("%"+ firstName +"%"));
conditionGroup.or(Condition.column(new NameAlias("lastName")).like("%"+ lastName +"%"));
SQLite.select().from(PersonnelTable.class)
.where(conditionGroup)
.queryList();
But the problem is I cannot understand how to put brackets to condition and now my query looks like: SELECT * FROM ‘PersonnelTable’ WHERE country LIKE ‘%UAE%’ AND region LIKE ‘%Abu-dabi%’ AND lastName LIKE ‘%ha%’ OR firstName LIKE ‘%ha%’
without any brackets.
Issue Analytics
- State:
- Created 8 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Living with multiple health problems - The personal impact of ...
Having multiple health conditions can affect people's ability to work and limit what they can do in their social lives. Things like pain,...
Read more >Create Issue - Multiple Conditions - Atlassian Community
My current goal is to create a new issue based off of an assigned team custom field. We are currently moving a ticket...
Read more >Solved: Multiple condition not working as expected
Solved: I have 24items in 4 locations and the below flow is only for one item. What I need is, whenever a quantity...
Read more >r - case_when() issue with evaluating multiple conditions
I am trying to detect if specific keywords and phrases are present in a string, and if they are I want to post...
Read more >Issue with multiple conditions - Jotform
I have a complex order form that depending on certain choices it changes to show different fields depending on the what they select...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Experienced the same issue in 3.0.0-beta5 (trailing AND when constructing a query like in this example). Refactoring out the highest level ConditionGroup solves it for me.