摘要:
下面的例子和SQL语句均在SQL Server 2008环境下运行通过,使用SQL Server自带的AdventureWorks数据库。详细出处参考:1.ROW_NUMBER()基本用法:SELECTSalesOrderID,CustomerID,ROW_NUMBER() OVER (ORDER BY SalesOrderID) AS RowNumberFROM Sales.SalesOrderHeader结果集:SalesOrderID CustomerID RowNumber--------------- ------------- ---------------43659 676 14 阅读全文