Sqlite Query for multiple values in one column

后端 未结 6 769
孤城傲影
孤城傲影 2020-12-30 14:07

I wanted to do query in table for field id with some vales like 1,5,4,11 which will come from previous screen according to selection.

cursor = database.query         


        
6条回答
  •  长发绾君心
    2020-12-30 14:52

    VolkerK was first to correctly answer the question, but for the sake of completeness here is a full example of how to use the IN operator:

    cursor = database.query(tablename,
                    new String[] { "TopName" }, "id IN (?)", new String[]{"2,3"}, null, null, null);
    

提交回复
热议问题