简体   繁体   中英

Using OR statment in condition sqlite database

I'm try to execute this query but not working in sqlite android database

"select CLFPSid from CheckLists where CLFPid = "+ section + " and ActionDate ='"+Date+"'and CLFPSid = 0 or 3 or 4 or 5"

the problem in using OR statment , note that CLFPSid is of type integer .

how to use or sqlite condition statement ?

You can't write

CLFPSid = 0 or 3 or 4 or 5

You should use the IN clause:

CLFPSid IN (0, 3, 4, 5);

Change your query as follows

 "select CLFPSid from CheckLists where CLFPid = "+ section + " 
           and ActionDate ='"+Date+"'and CLFPSid = 0 or CLFPSid = 3 
                                              or CLFPSid = 4 or CLFPSid = 5"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM