insert 表(id,部门) select id,case when id>=1 and id<=1000 then '部门1' when id>1000 and id<=1000 then '部门2' ...else then '部门N'end from 表 where