Sqlite Query for multiple values in one columm

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(tablename,
                    new String[] { "TopName" }, "id =?", new String[]{"2,3"}, null, null, null);

when i do like this i am getting cursor count 0,with new String[]{"2"} i am getting value i want for all ids with values in string array like OR which have value in that column.

Answers


You can use the IN operator like this,

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

Need Your Help

BPM vs ESB - Orchestration?

soa esb bpm orchestration eai

Can we safely say that if ESB provides Orchestration features, it is eligible to be an implementation of BPM?

Difference between Static variable declared in different scopes

c++ static

What is the difference between declaring static variable inside a block and outside a block in a file? Eg, here, what is difference between static variables a,b,c,d? Can we declare a static variabl...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.