mysql insert_select ID 自增长

insert into player_equipment (id,player_id,equipment_id,equipment_num) select @i:=@i+1 as id, t.* from (select 1,t.id,100 from s_car_equipment t) t ,(SELECT @i :=(select ifnull(max(a.id),0) from player_equipment a)) r; 

你可能感兴趣的:(mysql insert_select ID 自增长)