5

これらの列の 1 つは _bandwidth と呼ばれ、その中の値は 10 進数です。

したがって、既存の値に値を追加する SQL クエリを入力したいと思います。

ユーザー ID 1 の _bandwidth の値が 150.000 で、この値に 200 を加算すると、合計は 350.000 になります。

これは私が入力したクエリですが、うまくいきませんでした。

update users set _bandwidth = (select _bandiwdth from users where _ID = 1) + 150 where _ID = 1

また、次のようなことをしました:

update users set _bandwidth += 200 where _ID = 1

もちろん、それらは間違っていますが、私が達成したいことを理解していただければ幸いです。

よろしくお願いします。

編集 解決策が見つかり、答えは次のようになります。

update users set _bandwidth = _bandwidth + 200 where _ID = 1
4

3 に答える 3

7
update users 
set _bandwidth = _bandiwdth + 200
where _ID = 1
于 2013-11-12T18:16:24.570 に答える