查找学生的排名 -Sql Compact
我有一个这样的表:
Name Mar1 Mar2 Mar3 Total
xxx 80 80 80 240
yyy 60 70 50 180
aaa 85 65 75 225
我想根据总计找到学生的排名。我使用 SQL Compact 3.5 。由于我们在sql server中有rank()函数,我们是否有可以找到学生排名的东西???当我使用“选择总计,排名()超过(按总描述排序)i1 来自 stmarks “它给出的错误为
” 主要错误 0x80040E14,次要错误 25501
选择 Total,rank() over(按总描述排序)i1 来自stmarks 解析查询时出错。 [ 令牌行号 = 1,令牌行偏移 = 21,错误令牌 = 结束 ] ”
Sql Compact是否支持rank()或者还有其他方法吗???
I have a table like this :
Name Mar1 Mar2 Mar3 Total
xxx 80 80 80 240
yyy 60 70 50 180
aaa 85 65 75 225
I wanted to find the rank of the student based on total. I using SQL Compact 3.5 . As we have rank() function in sql server do we have something with which we can find the students rank??? When I used "select Total,rank() over (order by total desc) i1
from stmarks " it's giving error as
"
Major Error 0x80040E14, Minor Error 25501
select Total,rank() over (order by total desc) i1
from stmarks
There was an error parsing the query. [ Token line number = 1,Token line offset = 21,Token in error = over ]
"
Do Sql Compact support rank() over or is there any another way???
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据搜索结果,over() 似乎不适用于 sql-compact。因此,我尝试了此处中的自连接概念。只是我修改了查询,以便它可以正确处理重复值。删除等号。修改后的查询是:
它现在工作得很好。
According to the search result it seems over() doesn't work with sql-compact. So I tried the self join concept as in here. Just I modified the query so that it works with duplicate values properly . Remove the equal to sign. The modified query is :
It works great rite now.