SQLite语法错误 - 逗号

时间:2017-05-10 20:01:13

标签: android database sqlite

我试图在SQLite表中复制一行,但是我收到语法错误:

   android.database.sqlite.SQLiteException: near ",": syntax error (code 1): , while compiling: INSERT INTO tokens(colour, power, ts) SELECT (colour, power, ts) FROM tokens WHERE _id = 1

我的查询如下:

db.execSQL("INSERT INTO " + TABLE_TOKENS + "(" + COLUMN_COLOUR + ", " + COLUMN_POWER + ", " + COLUMN_TS + ")" +
            " SELECT (" + COLUMN_COLOUR + ", " + COLUMN_POWER + ", " + COLUMN_TS + ")" +
            " FROM " + TABLE_TOKENS +
            " WHERE _id = " + id);

对我来说它看起来很好,我猜它没有逗号就行不了......

1 个答案:

答案 0 :(得分:1)

选择投影在语法上不正确。将SELECT (colour, power, ts)更改为SELECT colour, power, ts