public long getCount(String column_x_Value) {
long count;
SQLiteDatabase db = this.getWritableDatabase();
Cursor c = db.rawQuery("SELECT * FROM " + TABLE_NAME + " WHERE " + column_x + "='" + column_x_Value+ "'", null);
//here column_x name of column and column_x_Value which is to be counted
count = c.getCount();
if (c != null && !c.isClosed())
c.close();
return count;
}
1条答案
按热度按时间qcbq4gxm1#
只需传递你的列值,你想计算它出现的次数。。。