|
发表于 2021-7-26 08:02
来自手机
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
drop table if exists temp;
create table temp as with recursive cn(i,v) as (values(1,'v')
union
select i+1 i,'v' v from cn where i<21 ),b as (select group_concat(v) 数据 from cn),a as (select regexp2('(.*)-(\d+)',编码,1) 编码2,regexp2('(.*)-(\d+)',编码,2) 编码3,* from 批量插入行原明细表),c as (select 编码2,max(编码3) maxnum from a group by 编码2),d as (select maxnum,编码2,substr(b.数据,1,c.maxnum*2-1) 数据 from b,c) select * from d;select split_data('temp');with x as (select *,(select count(1) from tempsplit where rowid<=aa.rowid and 编码2=aa.编码2) 编码3 from tempsplit aa),y as (select 编码2||'-'||printf('%03d',编码3) 编码 from x) select y.编码 编码,性别 from y left join 批量插入行原明细表 using(编码)
|
|