我有一个更新查询,我认为应该在一个请求中更新多行..
var cb = new Codebird;
cb.setConsumerKey("xxx", "xxx");
cb.setToken("xxx", "xxx");
var mediaid = "";
var img64 = img.toDataURL().split(",")[1];
var params = {
"media_data": img64
};
cb.__call(
"media_upload",
params,
function (reply, rate, err) {
mediaid = reply.media_id_string;
console.log(reply);
cb.__call(
"statuses_update", {
media_ids: mediaid,
status: msg
},
function (reply, rate, err) {
console.log(reply);
}
);
}
);
然而,这似乎只是更新X的val而不是Y的
答案 0 :(得分:4)
UPDATE myTable
SET val = val + 1
WHERE id = 'X'
OR id = 'Y'
或
WHERE id in ('X', 'Y')
答案 1 :(得分:1)
您的查询工作正常,但会忽略" Y"值因为它将被评估为:
UPDATE myTable SET val = val + 1 WHERE id = "X" or FALSE
因为" Y"将被评估为0,这是错误的。
你必须修复你的状况
(id = "X" or id = "Y")