将自动增量插入第二列

将自动增量插入第二列,第1张

将自动增量插入第二列
mysql> describe concattest;+-------+------------------+------+-----+---------+----------------+| Field | Type  | Null | Key | Default | Extra          |+-------+------------------+------+-----+---------+----------------+| id    | int(10) unsigned | NO   | PRI | NULL    | auto_increment || val   | text  | YES  |     | NULL    |     |+-------+------------------+------+-----+---------+----------------+2 rows in set (0.00 sec)mysql> INSERT INTO concattest (val) VALUES (concat('val', LAST_INSERT_ID()));Query OK, 1 row affected (0.06 sec)mysql> select * from concattest;+----+------+| id | val  |+----+------+|  1 | val0 |+----+------+1 row in set (0.00 sec)mysql> INSERT INTO concattest (val) VALUES (concat('val', LAST_INSERT_ID()));Query OK, 1 row affected (0.00 sec)mysql> select * from concattest;+----+------+| id | val  |+----+------+|  1 | val0 ||  2 | val1 |+----+------+2 rows in set (0.00 sec)mysql> INSERT INTO concattest (val) VALUES (concat('val', LAST_INSERT_ID()));Query OK, 1 row affected (0.00 sec)mysql> select * from concattest;+----+------+| id | val  |+----+------+|  1 | val0 ||  2 | val1 ||  3 | val2 |+----+------+3 rows in set (0.00 sec)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5044464.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-15
下一篇 2022-11-15

发表评论

登录后才能评论

评论列表(0条)

保存