开发者

I have a problem with an update command sql

 sb.Append("UPDATE Users AS u ");
    sb.Append(" SET u.Reputation = (u.Reputation + @Repuation)");
    sb.Append(" INNER JOIN Comments AS c ON c.UsersID=u.UsersID"开发者_如何学Python);
    sb.Append(" WHERE c.CommentsID=@CommentsID");

It tells me that I have an incorrect syntax near the syntax 'AS'


You SQL is incorrect assuming you are using MS SQL Server

It should be

UPDATE u
SET u.Reputation = (u.Reputation + @Reputation)
FROM Users u
INNER JOIN Comments c ON c.UsersID = u.UsersID
WHERE c.CommentsID = @CommentsID
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜