Home > database > Mysql stored procedure how to achieve similar functionality
Mysql stored procedure how to achieve similar functionality
Time:10-02
In addition to using group_concat, are there any other method can achieve similar code?
The set ids=(select GROUP_CONCAT (` id `) from ` table ` where flag=0). Insert into ` table ` select * from table where id in (ids); The update ` table ` set flag=1 where id in (ids);
CodePudding user response:
=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]);