select * from 二维转一维之装箱反堆叠后合计 limit 4; cli_unstack_all~二维转一维之装箱反堆叠后合计~箱数; create temp table aa as select regexp2('箱号_(M\d{1,2})',上层属性,1) 箱号,英文品名,中文品名,regexp2('箱子类型_(\d{1})',上层属性,1) 箱子类型,箱数,regexp2('重量_([\d\.]+)',上层属性,1) 重量 from 二维转一维之装箱反堆叠后合计_unstack order by 箱号 collate NATURAL_CMP; create temp table bb as select 箱号,箱子类型,英文品名, 中文品名,sum(箱数) 数量 from aa group by 箱号,英文品名 order by 箱号,箱子类型 collate NATURAL_CMP; select count(*) 行,箱号,箱子类型,group_concat(英文品名),group_concat(中文品名),group_concat(数量) from bb group by 箱号 order by 箱号 collate NATURAL_CMP; |