Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is this a valid SQLite query

I have:

String sqlite = "SELECT count(_id) AS _lCount FROM answers WHERE phase = 3 and correct_incorrect='1'    

as a query, but I need the correct_incorrect column to also take into account a "1*"

Would this be a valid way to account for it?

String sqlite = "SELECT count(_id) AS _lCount FROM answers WHERE phase = 3 and correct_incorrect='1'or'1*'

I would test it, but the possibility of a "1*" is rare and would take a few hours of testing. So I want to make sure I'm not just wasting my time.

like image 727
EGHDK Avatar asked Nov 21 '25 13:11

EGHDK


2 Answers

try it by using IN

String sqlite = "SELECT count(_id) AS _lCount FROM answers WHERE phase = 3 and correct_incorrect IN ('1','1*')"
like image 185
John Woo Avatar answered Nov 23 '25 03:11

John Woo


As far as I know, It should be something like:

String sqlite = "SELECT count(_id) AS _lCount FROM answers WHERE phase = 3 and (correct_incorrect='1' or correct_incorrect = '1*')
like image 40
kosa Avatar answered Nov 23 '25 02:11

kosa