Reputation: 210
I am trying to pull out rows in the database based on multiple conditions. With code, the condition can be written as
if (type == "person" && (name == "John" || name == "David"))
Right now I am getting the cursor like so : type = ? and name = ? or name = ?
Is this correct? Because I don't know how to express the brackets, I don't want the selection to become: ((type == "person" && name == "John") || name == "David")
Upvotes: 0
Views: 297
Reputation: 38098
... Because I don't know how to express the brackets...
Use the brackets just as you do in Java:
SELECT [Field List] FROM [Table Name] WHERE type = ? AND (name = ? OR name = ?)
Upvotes: 1