set ids = (select GROUP_CONCAT(`id`) from `table` where flag=0);
insert into `table` select * from table where id in(ids);
update `table` set flag=1 where id in(ids);
...全文
1953打赏收藏
mysql 存储过程如何实现类似的功能
除了使用group_concat,还有其他方法可以实现类似的代码吗? set ids = (select GROUP_CONCAT(`id`) from `table` where flag=0); insert into `table` select * from table where id in(ids); update `table` set flag=1 where id in(ids);
=sql]insert into `table` select * from table where id in(select id from `table` where flag=0);
update `table` set flag=1 where id in(select id from `table` where flag=0[code[/code]);