sb.Append("SELECT u.Reputation");
sb.Append(" FROM Users AS u");
sb.Append(" INNER JOIN Comments AS c ON c.UsersID=u.UsersID");
sb.Append(" WHERE c.CommentsID=@CommentsID");
我想从users表中选择那个值..Reputation,然后将数字5插入它..我该怎么做..?我希望用户信誉在数据库中的值为5。
答案 0 :(得分:3)
UPDATE Users u
SET u.Reputation = (u.Reputation + 5)
INNER JOIN Comments AS c ON c.UsersID=u.UsersID
WHERE c.CommentsID=@CommentsID