开发者

I have a problem with an update command sql

开发者 https://www.devze.com 2023-03-16 11:51 出处:网络
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("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

精彩评论

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