sql 如何插入自身表最大值? A 表 字段 如下ID modify numID 是主键 且自增需要给 A表插入 最大 num+1 后值 我是这样的写的 但报错INSERT INTO A VALUES(NULL,1,(select max(num) from A));如上要求如要通过怎么的 SQL 语句实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 INSERT INTO Aselect NULL,1,max(num) from A; insert into Aselect null,1,max(num)+1from a INSERT INTO Aselect NULL,1,max(num)+1 from A; 如果换成 update 需要怎样写呢 insert inot A VALUES select NULL,1,max(num)+1 from A update a , (select max(num)+1 as k from A) bset a.num=b.k insert: insert into a select null, 1, max(num)+1 from a;update: update a, (select max(num) as k from A) b set a.num = b.k+1 where a.num=b.k; 求一条mysql 语句??? MySQL菜鸟问题,呵呵 求一条插入语句! 采用mysql开发的数据库应用程序,在安装到其他电脑上的时候,可以不安装mysql,而把mysql数据库当成一个文件连接到应用程序中使用吗?就 巨奇怪问题 请问Linux下我的mysqlgui客户端为什么连不到mysql的服务端呢?该怎么办呢? 如何用C语言操作.MYD文件? Mybatis 怎么返回insert插入的主键 怎么把一样值字段的日期汇总到一块 MySQL IFNULL函数不起作用 联合查询表的问题请教 mysql标准差
select NULL,1,max(num) from A;
select null,1,max(num)+1
from a
select NULL,1,max(num)+1 from A;
如果换成 update 需要怎样写呢
set a.num=b.k
update: update a, (select max(num) as k from A) b set a.num = b.k+1 where a.num=b.k;