如何用两个条件查询SQLite数据库?

我有一个关于员工的表,有3列,如下面的代码:

db.execSQL("CREATE TABLE " + TABLE_NAME + " (" + _ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + DEPT + " TEXT NOT NULL," + NAME + " TEXT NOT NULL," + CITY + " TEXT NOT NULL);"); 

现在我只想在DEPT和CITY(ei都是HCM City和Sales部门的员工)中展示员工。 如何查询才能获得它?

@DienTrinh,你做得对,请注意AND周围的空格。 这对你有用。

  Cursor cursor = db.query(TABLE_NAME, new String [] {_ID, NAME, DEPT, CITY }, DEPT +"=?" +" AND " + CITY +"=?", new String[] {"Sales", "HCM" }, null, null, null); 

解决方案是:

 SELECT * FROM Employess WHERE DEPT='Sales' COLLATE NOCASE AND City='HCM' COLLATE NOCASE 
 SELECT * FROM Employees WHERE DEPT='Sales' AND City='HCM'