vf中有像excel中rank一样自动返回学生名次的函数吗?该怎样实现呢?急需……
------解决方案--------------------------------------------------------
不知道VF是否支持子查询,请参考sql server相关用法。
- SQL code
表jh03有下列数据:name scoreaa 99bb 56cc 56dd 77ee 78ff 76gg 78ff 501. 名次生成方式1,Score重复时合并名次SELECT * , Place=(SELECT COUNT(DISTINCT Score) FROM jh03 WHERE Score >= a.Score)FROM jh03 aORDER BY Place结果Name Score Place ---------------- ----------------- ----------- aa 99.00 1ee 78.00 2gg 78.00 2dd 77.00 3ff 76.00 4bb 56.00 5cc 56.00 5ff 50.00 62. 名次生成方式2 , Score重复时保留名次空缺SELECT * , Place=(SELECT COUNT(Score) FROM jh03 WHERE Score > a.Score) + 1FROM jh03 aORDER BY Place结果Name Score Place --------------- ----------------- ----------- aa 99.00 1ee 78.00 2gg 78.00 2dd 77.00 4ff 76.00 5bb 56.00 6cc 56.00 6ff 50.00 8