0

试图找出实现字段排名的最佳方法

4

1 回答 1

0

你的问题不是很清楚。

您可以尝试使用 DENSE_RANK 函数 SQL Server:'http://msdn.microsoft.com/en-us/library/ms173825.aspx' Oracle:http ://www.techonthenet.com/oracle/functions/dense_rank.php

mysql:

set @sno:=0;
set @names:='';
select @sno:=case when @names=names then @sno else @sno+1 end as sno,@names:=names as names from test
order by names;
于 2012-07-27T09:23:55.250 回答