需要每10个字符拆分列引用值,并为每个行ID显示它
我有这样的数据
ID Reference
1 405123 ap41502 ag067156
2 a450912 d109456
3 4a4122 g567412 ol09123 pl212671 et61789
4 6t3450 41234a3 01a459014
所需结果:
ID Reference
1 405123 ap
1 41502 ag
1 067156
2 a450912
2 d109456
3 4a4122 g
3 567412 ol
3 09123 pl2
3 12671 et61
3 789
4 6t3450 4
4 1234a3 0
4 1a459014
您可以使用数字/理货表格。将您的表交叉连接到数字表
select *, substring(t.Reference, (n.n * 10) + 1, 10)
from yourtable t
cross join numbers n
where n.n >= 0
and n.n < ceiling(len(t.Reference) / 10.0)
order by ID, n.n
注意:理货表应包含0行
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句