开发者

How can I insert a value to the value that i just selected?

开发者 https://www.devze.com 2023-03-16 09:03 出处:网络
sb.Append(\"SELECT u.Reputation\"); sb.Append(\" FROM Use开发者_运维百科rs AS u\"); sb.Append(\" INNER JOIN Comments AS c ON c.UsersID=u.UsersID\");
sb.Append("SELECT u.Reputation");
sb.Append(" FROM Use开发者_运维百科rs AS u");
sb.Append(" INNER JOIN Comments AS c ON c.UsersID=u.UsersID");
sb.Append(" WHERE c.CommentsID=@CommentsID");

I want to select that value ..Reputation from the users table and then insert the number 5 to it.. how do I do that..? I want the users reputation go by value of 5 in the database.


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

精彩评论

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