1>每行数据加统计列 COUNT(0) OVER() AS TotalCount 2>按指定列排序 SELECT sCellid,N_CI,city,scantime,row_number() over(partition BY city,scantime,SCELLID ORDER BY distance DESC)seq FROM MR_MRO_LteNCELL WHERE sCellid IS NOT NULL AND ENODEBid IS NOT NULL AND city IS NOT NULL AND Redundant_LTENCELL='Y' AND 1=1 and scantime>='2016-01-01' and scantime<'2016-02-21'
欢迎关注NetAnalyzer公共号