Reputation: 179
I have a sqlite table with many columns and I'm trying to provide the user with multiple conditions (i.e options) of accessing. This give rise to a range of outcomes encompassing the below
1 "SELECT * FROM table where apple >= 3 and orange >= 1;"
2 "SELECT * FROM table where apple = 0 and orange >= 1;"
3 "SELECT * FROM table where apple = 4 and juice = 0;"
Is there any way to combine all of the above in a single db.query() statement and to prevent duplicate of results?
Thanks in advance.
Upvotes: 0
Views: 425
Reputation: 863
Probably you are looking for this
SELECT * FROM table where (apple >= 3 and orange >= 1) or (apple = 0 and orange >= 1) or (apple = 4 and juice = 0)
Upvotes: 1