如题:
在Delphi+Access的环境下
表中有多个字段:A1 B1 A2 B2 A3 B3 A4 B4 ...
80.1 1 75.32 2 50.3 5 69.43 3 ...
73.22 3 63.5 3 64.34 4 54.78 4 ...
. . . . . . . .
. . . . . . . .B1是根据A1得到排序结果,B2是根据A2得到排序结果,B3是根据A3排序结果...,有十个字段需要这样排序问:有什么方法能快速得到结果?
在Delphi+Access的环境下
表中有多个字段:A1 B1 A2 B2 A3 B3 A4 B4 ...
80.1 1 75.32 2 50.3 5 69.43 3 ...
73.22 3 63.5 3 64.34 4 54.78 4 ...
. . . . . . . .
. . . . . . . .B1是根据A1得到排序结果,B2是根据A2得到排序结果,B3是根据A3排序结果...,有十个字段需要这样排序问:有什么方法能快速得到结果?
这个用冒泡就可以,O(N^2)...
用SQL语句即可排序。
select A1,(select count(*) from urtable where id<a.A1) as B1,A1,(select count(*) from urtable where id<a.A2) as B2 from urtable a另外你也可以用临时表
字段名 A1 B1 A2 B2 A3 B3 A4 B4 ...
记录 80.1 1 75.32 2 50.3 5 69.43 3 ...
73.22 3 63.5 3 64.34 4 54.78 4 ...
. . . . . . . .
. . . . . . . .
我想要快速排序的方法。