因此,我尝试选择一个条件,其中值= value *,条件是另一个布尔值为true。我这样写了一个查询,因为我不是sqlite的新手,所以对语法感到抱歉:
public int getPlaceCount(String name){
SQLiteDatabase db = this.getWritableDatabase();
String query = "SELECT COUNT(*) FROM " + TABLE + " WHERE " + NAME + " = ? AND " + CURRENT + " <> ?";
String value = "0";
Cursor cursor = db.rawQuery(query,new String[]{name,value});
int count = cursor.getInt(cursor.getColumnIndex("COUNT(*)"));
return count;
}
现在在mysql中,我将执行以下操作:
select count(*) from TABLE where NAME='name' and CURRENT=1;
预先感谢
答案 0 :(得分:1)
我知道了。我需要将光标移到第一位:
cursor.moveToFirst();