Android Question SQL.ExecQuery2 question

parijs

Active Member
Licensed User
Longtime User
I want to sellect thinks from A,B,C,D,E but only if Z = "yes" in the db
So A also corresponded with what I look but because z = "no", I do not want it
I use the code below but it does not work.


B4X:
oRst = SQL.ExecQuery2("SELECT * FROM visit WHERE wijk = ? OR wijk = ? OR wijk = ? OR wijk = ? OR wijk = ? AND Z = ?", Array As String (A, B, C, D, E, "yes"))

;)
 

Mahares

Expert
Licensed User
Longtime User
Here you go: Please note that I assume wijk and Z are table fields here.
B4X:
oRst = SQL.ExecQuery("SELECT * FROM visit WHERE wijk IN('A','B','C','D','E') AND Z = 'yes'")
 
Last edited:
Upvote 0

Straker

Active Member
Licensed User
Longtime User
Or just place all your OR inside parenthesis leaving AND outside. But mahares code is better.
 
Upvote 0
Top