首页 > 代码库 > Sql PARTITION BY

Sql PARTITION BY

 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 = 1ORDER BY t2.RowNumber ASC

 

Sql PARTITION BY