回答編集履歴
2
追記
answer
CHANGED
@@ -14,4 +14,11 @@
|
|
14
14
|
insert into test values(1, 0, 0, 0) on duplicate key update
|
15
15
|
baz = bar + 1,bar = foo + 1,foo = foo + 1;
|
16
16
|
```
|
17
|
-
のようidを明示してinsertして、逆からいれてあげるだけじゃないですか?
|
17
|
+
のようidを明示してinsertして、逆からいれてあげるだけじゃないですか?
|
18
|
+
|
19
|
+
# 追記
|
20
|
+
あまり推奨されていませんが変数経由で処理することも検討ください
|
21
|
+
```SQL
|
22
|
+
insert into test values(1, 0, 0, 0) on duplicate key update
|
23
|
+
foo = (@a:=foo) + 1,bar = (@b:=bar)*0 + @a + 1,baz = @b + 1;
|
24
|
+
```
|
1
typo
answer
CHANGED
@@ -14,4 +14,4 @@
|
|
14
14
|
insert into test values(1, 0, 0, 0) on duplicate key update
|
15
15
|
baz = bar + 1,bar = foo + 1,foo = foo + 1;
|
16
16
|
```
|
17
|
-
のようidを明示してinsertして、逆からいれて
|
17
|
+
のようidを明示してinsertして、逆からいれてあげるだけじゃないですか?
|