从包含许多子句的表中选择数据

时间:2012-06-16 10:32:42

标签: android database sqlite

我尝试从数据库表中选择包含许多条件子句的数据,其中我的代码看起来像

Cursor cursor = sqliteDatabase.rawQuery("SELECT "+  
                AndroidOpenDbHelper.COLUMN_NAME_FILE_NAME+" FROM " + 
                AndroidOpenDbHelper.TABLE_FILE + " where "+ 
                AndroidOpenDbHelper.COLUMN_NAME_FILE_CATEGORY+" = "+ category+","+
                AndroidOpenDbHelper.COLLUMN_NAME_FILE_THEME+" = "+theme+","+ 
                AndroidOpenDbHelper.COLLUMN_NAME_FILE_DATE_CREATING+"="+date);

我知道这是代码不正确,我该如何纠正呢

1 个答案:

答案 0 :(得分:0)

使用一个WHERE并将条件与AND

组合

...其中a = 5 AND b = 7 AND c ='Ivan'