当有多个需要满足的条件时,如何查询sqlite

Wha*_*107 0 sqlite android where-clause

我正在使用内容提供程序,需要查询一个表,其中row = thing1的一列和同一行的另一列= thing2.我知道你可以查询一个表只有一个条件,如:

Cursor c = contentResolver.query(content_uri, projection, variable + "='" + thing1 + "'", null, null);
Run Code Online (Sandbox Code Playgroud)

现在我如何查询两个条件?任何帮助,将不胜感激.

Com*_*are 5

这应该工作:

Cursor c = contentResolver.query(content_uri, projection, "col1=? AND col2=?", args, null);
Run Code Online (Sandbox Code Playgroud)

where args是在查询中String[]替换的值的值?.