码迷,mamicode.com
首页 > 数据库 > 详细

Sql PARTITION BY

时间:2015-01-18 23:54:08      阅读:296      评论:0      收藏:0      [点我收藏+]

标签:

 SELECT t2.* ,
        t2.RowNumber
 FROM   ( SELECT    row_number() OVER ( PARTITION BY t.PartitionColumn ORDER BY t.ID DESC ) RowNumber ,
                    t.*
          FROM      Table t
        ) t2
--WHERE   t2.RowNumber = 1
ORDER BY t2.RowNumber ASC

 

Sql PARTITION BY

标签:

原文地址:http://www.cnblogs.com/mtsl/p/4232470.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!