简体   繁体   中英

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");
    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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM