同一字段如何按多个条件排序
表中有一字段,从01-30按升序排列,现在我想让它按01,02,03,04,05,10,09,08,07,06,11,12,13,14,15,20,19,18,17,16,21,22,23,24,25,30,29,28,27,26,即5*6的一条龙排序,怎么办呢?
[解决办法]
*-- vfp9.0 以下Create Cursor t1 (num i)For lnI=1 To 30 Insert Into t1 Values (lnI)EndforBrowse && 排序前Select num,Iif(Mod(num,10)=6,Int(num/10)*10+10,Iif(Mod(num,10)=7,Int(num/10)*10+9,Iif(Mod(num,10)=9,Int(num/10)*10+7,Iif(Mod(num,10)=0,Int(num/10)*10+6-10,num)))) As npx From t1 Order By npx && 排序后的第1列
[解决办法]
Create Cursor t1(Num I,SortName I)
Index on SortName tag SortName
For i=1 to 30
Insert into t1 values(i,IIF(MOD(INT((i-1)/5),2)=0,i,i*(-1)+(INT((i-1)/5))*10+6))
Endfor
Select t1
Browse