我有一个更新命令sql的问题

时间:2011-06-28 16:23:32

标签: c# asp.net 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");
    sb.Append(" WHERE c.CommentsID=@CommentsID");

它告诉我语法'AS'附近的语法不正确

1 个答案:

答案 0 :(得分:3)

假设您正在使用MS SQL Server

,则SQL不正确

应该是

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