MOHS3N
MOHS3N

Reputation: 247

Android Sqlite search date via "selection" and "selectionArgs"

I used a code similar to the following code to search the database between two dates :

cursor.query(select column from Table where columnDate between '2018-09-20' and '2018-09-23');

But now I want to use query projection,selectionand selcetionArgs.

How can I update my code?

Upvotes: 0

Views: 150

Answers (1)

Farrokh
Farrokh

Reputation: 1167

you can use this:

cursor.query("Table" ,
    new String[]{"column"},
    "columnDate BETWEEN ? AND ?", 
    new String[]{"2018-09-20","2018-09-23"},
    null/*Group by if you need*/,
    null/*having if you need*/,
    null/*order by if you need*/);

Upvotes: 1

Related Questions