问题描述
SQL Server Compact Edition似乎不支持RANK()函数。 (请参见 Functions(SQL Server Compact Edition),网址为)。
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 Server Compact Edition SELECT语句中复制Rank函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!