我正在用
创建一个表CREATE TABLE bereitsgespielt (id INTEGER PRIMARY KEY,
dateiname TEXT, startzeit NUMERIC,
endzeit NUMERIC);
我进入了
1 Hallo 3 4
2 Hallo 5 6
我想更新最后一个条目的endzeit
,即最高id
。
我试过
UPDATE `bereitsgespielt` SET endzeit = 5
WHERE dateiname = 'Hallo' ORDER DESC LIMIT 1;
UPDATE bereitsgespielt SET endzeit = 5
WHERE dateiname = 'Hallo' ORDER BY DESC LIMIT 1;
两人都崩溃了SQLite Database Browser 2.0 b1
。
UPDATE bereitsgespielt SET endzeit='5' WHERE rowid=2;
作品。
答案 0 :(得分:0)
您应该在function onFormSubmit(e) {
// Initialize
var name = e.range.getSheet().getName();
// If the response was not submitted to the right sheet, exit.
if (name != "Job Submission") return;
var values = e.values;
var returnedDocValues = createNewDoc(values);
var copyId = returnedDocValues[0];
var docName = returnedDocValues[1];
printGoogleDocument(copyId, docName);
}
子句中指定列:
ORDER BY
答案 1 :(得分:0)
您必须使用子查询查找最后一个ID:
UPDATE bereitsgespielt
SET endzeit = 5
WHERE dateiname = 'Hallo'
AND id = (SELECT max(id)
FROM bereitsgespielt
WHERE dateiname = 'Hallo'); -- same filter here