YanoRyuichi.com/
Wiki
Blog
GitHub
Sandbox
開始行:
* 主キーがなければINSERTしてあればUPDATE - INSERT ON DUPL...
CREATE TABLE t1 ( id1 int UNIQUE, id2 int);
INSERT INTO t1 ( id1, id2 ) VALUES ( 1, 100 ) ON DUPLICA...
+------+------+
| id1 | id2 |
+------+------+
| 1 | 100 |
+------+------+
INSERT INTO t1 ( id1, id2 ) VALUES ( 1, 100 ) ON DUPLICA...
+------+------+
| id1 | id2 |
+------+------+
| 1 | 101 |
+------+------+
** 参考 [#t31d29e8]
https://stackoverflow.com/questions/6030071/mysql-table-i...
終了行:
* 主キーがなければINSERTしてあればUPDATE - INSERT ON DUPL...
CREATE TABLE t1 ( id1 int UNIQUE, id2 int);
INSERT INTO t1 ( id1, id2 ) VALUES ( 1, 100 ) ON DUPLICA...
+------+------+
| id1 | id2 |
+------+------+
| 1 | 100 |
+------+------+
INSERT INTO t1 ( id1, id2 ) VALUES ( 1, 100 ) ON DUPLICA...
+------+------+
| id1 | id2 |
+------+------+
| 1 | 101 |
+------+------+
** 参考 [#t31d29e8]
https://stackoverflow.com/questions/6030071/mysql-table-i...
ページ名: