如何在Sql Server Compact Edition SELECT语句中复制Rank函数? [英] How would I duplicate the Rank function in a Sql Server Compact Edition SELECT statement?

查看:192
本文介绍了如何在Sql Server Compact Edition SELECT语句中复制Rank函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

SQL Server Compact Edition似乎不支持RANK()函数。 (请参见 Functions(SQL Server Compact Edition),网址为 http://msdn.microsoft.com/en-us/library/ms174077(SQL.90).aspx )。

It doesn't look like SQL Server Compact Edition supports the RANK() function. (See Functions (SQL Server Compact Edition) at http://msdn.microsoft.com/en-us/library/ms174077(SQL.90).aspx).

如何我将在 SQL Server Compact Edition SELECT语句中复制RANK()函数。

How would I duplicate the RANK() function in a SQL Server Compact Edition SELECT statement.

(请对任何示例select语句使用Northwind.sdf ,因为这是我可以使用SQL Server 2005 Management Studio打开的唯一文件。)

(Please use Northwind.sdf for any sample select statements, as it is the only one I can open with SQL Server 2005 Management Studio.)

推荐答案

SELECT x.[Product Name], x.[Unit Price], COUNT(y.[Unit Price]) Rank 
FROM Products x, Products y 
WHERE x.[Unit Price] < y.[Unit Price] or (x.[Unit Price]=y.[Unit Price] and x.[Product Name] = y.[Product Name]) 
GROUP BY x.[Product Name], x.[Unit Price] 
ORDER BY x.[Unit Price] DESC, x.[Product Name] DESC;

查找学生排名的方法-Sql Compact 修改为
查找学生的排名-Sql Compact

这篇关于如何在Sql Server Compact Edition SELECT语句中复制Rank函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆