我遇到了如何在rawQuery中放置AND
条件的问题。我想getCount WHERE SQLiteHelper.product_FId =listId AND SQLiteHelper.product_Status==1
...我应该在哪里添加其他条件WHERE SQLiteHelper.product_Status==1
?
public int getCountComplePro(String listId) {
// TODO Auto-generated method stub
String[] args = { listId };
int x = 0;
Cursor cur=database.rawQuery("SELECT * FROM "
+ SQLiteHelper.productTable + " WHERE "
+ SQLiteHelper.product_FId +"=?" ,args);
x=cur.getCount();
}
cur.close();
return x;
希望有人能指导我解决这个问题...
答案 0 :(得分:1)
String[] args = { listId };
Cursor cur=database.rawQuery("SELECT * FROM "
+ SQLiteHelper.productTable + " WHERE "
+ SQLiteHelper.product_FId +"=?"
+ "AND "+SQLiteHelper.product_Status+ "=1",args);
不应该这样做吗?