获取错误:由以下原因引起:android.database.sqlite.SQLiteException:near";TABLENAME";编译SELECT查询时出现语法错误(代码1)
编译SELECT查询时出现以下错误:获取错误:由以下原因引起:android.database.sqlite.SQLiteException:near";TABLENAME";编译SELECT查询时出现语法错误(代码1),android,sqlite,Android,Sqlite,编译SELECT查询时出现以下错误: Caused by: android.database.sqlite.SQLiteException: near "group": syntax error (code 1): , while compiling: SELECT group_id, logo FROM group WHERE group_name = 'Empty Group' 查询创建为: c = database.query(TABLE_GROUP, new String[]{KEY_
Caused by: android.database.sqlite.SQLiteException: near "group": syntax error (code 1): , while compiling: SELECT group_id, logo FROM group WHERE group_name = 'Empty Group'
查询创建为:
c = database.query(TABLE_GROUP, new String[]{KEY_GROUPID, KEY_LOGO}, KEY_GROUPNAME + " = '" + description + "'", null, null, null, null);
与:
以及表的创建脚本:
create table group
(group_id integer primary key autoincrement,
group_name text not null,
logo string);
有人知道出了什么问题吗?组是一个
SQLITE
关键字,与每个保留字一样,它不能将其用作表/列名。要修复,请为列选择其他名称。您可以找到SQLITE
保留关键字的列表确保您已在数据库中创建了组表确保“group”不是关键字。将表的名称更改为其他名称,然后检查您是否完全正确。我完全忘记了SQL中可以使用“groupby”。我需要有人记得我!非常感谢。
create table group
(group_id integer primary key autoincrement,
group_name text not null,
logo string);