UPDATE newsreactions
SET newsreactions.enabled = '0'
FROM newsreactions
INNER JOIN users ON newsreactions.memberId = users.id
WHERE users.active = '0' AND users.comment LIKE '%spam%'
出于某种原因,我收到语法错误:
1064 - 您的SQL语法出错;查看与您的MySQL服务器版本相对应的手册,以便在'FROM newsreactions INNER JOIN用户附近使用正确的语法ON newsreactions.memberId = users.id WHERE u'在第3行
虽然无法理解。
如果我将update
和set
替换为select
,则可以正常使用。
答案 0 :(得分:5)
错误1064是MySQL语法错误。正确的MySQL语法是:
UPDATE newsreactions nr INNER JOIN
users u
ON nr.memberId = u.id
SET nr.enabled = 0
WHERE u.active = 0 AND u.comment LIKE '%spam%';
注意:
JOIN
符合UPDATE
条款。enabled
和active
确实是数字值。如果是这样,请不要使用单引号。答案 1 :(得分:1)
Obj = {
"elements":[
{"name":"something","id":"v1-234"},
{"name":"somethingElse","id":"v1-239"}
],
"paging":{
"next" : "100",
"total": "2000"
},
"linked"={
"partners":[
{"id":"82","name":"A"},
{"id":"83","name":"B"}
],
"instructors":
[
{"id":"11232","name":"alex"},
{"id":"11432","name":"boob"}
]
}
}
子句应该在join
子句之前,并且MySQL中不应该有set
子句:
from