3

我有:

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

作为查询,但我需要正确的不正确列也考虑到“1 *”

这是一种有效的解释方法吗?

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

我会测试它,但“1*”的可能性很少,需要几个小时的测试。所以我想确保我不只是在浪费时间。

4

3 回答 3

6

尝试使用IN

String sqlite = "SELECT count(_id) AS _lCount FROM answers WHERE phase = 3 and correct_incorrect IN ('1','1*')"
于 2012-11-29T05:18:13.983 回答
2

据我所知,它应该是这样的:

String sqlite = "SELECT count(_id) AS _lCount FROM answers WHERE phase = 3 and (correct_incorrect='1' or correct_incorrect = '1*')
于 2012-11-29T05:09:21.280 回答
1

由于这里给出了许多查询,但我认为 '1' 会出现在 '1*' 中

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

这个查询呢?

于 2012-11-29T05:22:18.773 回答