user3245658
user3245658

Reputation: 93

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 ?

Upvotes: 0

Views: 67

Answers (2)

Ruchira Gayan Ranaweera
Ruchira Gayan Ranaweera

Reputation: 35587

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"

Upvotes: 1

Kon
Kon

Reputation: 10810

You can't write

CLFPSid = 0 or 3 or 4 or 5

You should use the IN clause:

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

Upvotes: 3

Related Questions