update 有张表 a,(select id,count(*) as n from 有张表 b ,有张表 c where b.id>=c.id) d set a.id=d.n where a.id=d.id
UPDATE a3 a INNER JOIN ( SELECT a.id,100+COUNT(b.`id`) AS nid FROM a3 a LEFT JOIN a3 b ON a.`id`>b.`id` GROUP BY a.`id`) b ON a.`id`=b.id SET a.id=b.nid;
update table set id=@num:=@num+1 ;
set a.id=d.n
where a.id=d.id
SELECT a.id,100+COUNT(b.`id`) AS nid FROM a3 a LEFT JOIN a3 b ON a.`id`>b.`id` GROUP BY a.`id`) b
ON a.`id`=b.id
SET a.id=b.nid;
麻烦你能解释一下这语句吗?@num:这些没有用过 - - 定义变量?冒号又是什么
我测试的结果是:[Err] 1052 - Column 'id' in field list is ambiguous
单独运行,看看结果
set a.id=d.n
where a.id=d.id