gpt4 book ai didi

android - 语法错误sqlite内部联接

转载 作者:行者123 更新时间:2023-12-03 08:22:55 26 4
gpt4 key购买 nike

这是我在数据库解决方案中的代码

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 != ?

请检查一下并告诉我一个collect语法。谢谢观看:))))

最佳答案

JOIN和表1名称之间没有空格(“”)。在表名和之间还有额外的空间。列名

更改为:

SELECT title, filepath FROM books INNER JOIN theme ON books.bookID = theme.bookID WHERE bookID != ?

而且我认为您会没事的。

希望这可以帮助。

关于android - 语法错误sqlite内部联接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21646325/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com