Access中标题章节号排序

数据抓取后对Access中标题章节号进行自然数字排序。如1.2.1,1.2,1.3,1.3.1之类的章节号
select num,
instr(1,num,'.') as i1,
instr(i1+1,num,'.') as i2,
instr( iif(i2>0,i2+1,3),num,'.') as i3,
iif(i3<=0,0,instr( iif(i3>0,i3+1,5),num,'.')) as i4,
mid(num,1,i1-1) as n1,
mid(num,i1+1,iif(i2>0,i2-i1-1,len(num)-i1)) as n2,
iif(i2>0,mid(num,i2+1,iif(i3>0,i3-i2-1,iif(i2>0,len(num)-i2,0))),0) as n3,
iif(i2>0,mid(num,i3+1,iif(i4>0,i4-i3-1,iif(i3>0,len(num)-i3,0))),0) as n4,
标题,
内容
from content


select * from view1 order by val(iif(n1='A',99,n1)),val(n2),val(n3),val(n4) asc

你可能感兴趣的:(Access中标题章节号排序)