我试图在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);
对我来说它看起来很好,我猜它没有逗号就行不了......
答案 0 :(得分:1)
选择投影在语法上不正确。将SELECT (colour, power, ts)
更改为SELECT colour, power, ts
。