在SQLite数据库中选择Where And Where命令(Android)

时间:2015-10-24 22:24:33

标签: android database sqlite android-studio

此代码有效:

     Cursor cursor=database.rawQuery("SELECT * FROM "+dbHelper.TABLE_NAME+" where `" +
            dbHelper.MyShifts_Month + "`=" + month ,null);

这并不是:

 Cursor cursor=database.rawQuery("SELECT * FROM "+dbHelper.TABLE_NAME+" where `" +
            dbHelper.MyShifts_Month + "`=" + month + " and " + dbHelper.MyShifts_year + "`=" + year,null);

我该如何写" AND"正确的,以使其工作?

1 个答案:

答案 0 :(得分:2)

似乎缺少单引号,它应该是“和`”