0
這是我在數據庫解決方案語法錯誤sqlite的內部連接
public HashMap<String, String> getBookTheme(){
HashMap<String, String> hm = new HashMap<String, String>();
Cursor cursor = db.rawQuery("SELECT title, filepath FROM " +
BooksDBHelper.TABLE_BOOK + " INNER JOIN" + BooksDBHelper.TABLE_THEME +
" ON " + BooksDBHelper.TABLE_BOOK + " . " +
BooksDBHelper.KEY_BOK_ID + " = " + BooksDBHelper.TABLE_THEME +
" . " + BooksDBHelper.KEY_BOK_ID, null);
cursor.moveToLast();
if(cursor.getCount() != 0){
do{
hm.put("title", cursor.getString(cursor.getColumnIndex(BooksDBHelper.KEY_TITLE)));
hm.put("Theme", cursor.getString(cursor.getColumnIndex(BooksDBHelper.KEY_fILEPATH)));
}while(cursor.moveToNext());
}
return hm;
}
代碼,這是我的logcat錯誤
android.database.sqlite.SQLiteException: near "ON": syntax error (code 1): , while compiling: SELECT title, filepath FROM books INNER JOINtheme ON books . bookID = theme . bookID WHERE bookID != ?
請檢查一下,並告訴我一個對方付費的語法。感謝收看:) )))
很高興我能幫忙:) @ user3001046 –