Android Sqlite 搜索日期通过 "selection" 和 "selectionArgs"



我使用类似于以下代码的代码在两个日期之间搜索数据库:

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

但是现在我想使用查询projectionselectionselcetionArgs

如何更新我的代码?

你可以使用这个:

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*/);

最新更新